text:
package io.itlit.ItLit;

import android.app.Activity;
import android.graphics.Bitmap;
import android.os.AsyncTask;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions;
import org.json.JSONArray;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.HashMap;

public class GetLit extends AsyncTask<Activity, Void, Void> {

    public static JSONArray oldFriends = null; // This is a copy that the info window can query
    private static HashMap<String, Marker> oldMarkers; // The last set of markers drawn on TabFragment.googleMap
    private static ArrayList<Marker> burnMarkers;
    private static float oldZoom = 0.0f;

    @Override
    protected Void doInBackground(Activity... activities) {
        if (activities.length == 0)
            return null;
        Activity ui = activities[0];

        if (Const.googleMap != null) {
            try {
                JSONObject auth = new JSONObject();
                auth.put("uname", Const.uname);
                auth.put("passwd", Const.passwd);

                final JSONObject resp = new JSONObject(Network.getlit(auth.toString()));
                if (resp.has("error")) {
                    return null;
                } else if (resp.has("friends")) {
                    ui.runOnUiThread(new Runnable() {
                        @Override
                        public void run() {
                            try {
                                JSONArray frens = resp.getJSONArray("friends");
                                oldFriends = frens;
                                HashMap<String, Marker> newMarkers = new HashMap<>();
                                int i;
                                for (i = 0; i < frens.length(); i++) {
                                    JSONObject fren = frens.getJSONObject(i);
                                    MarkerOptions mo = new MarkerOptions();
                                    final String fname = fren.getString("fname");
                                    mo.title(fname);
                                    LatLng latlon = new LatLng(fren.getDouble("lat"), fren.getDouble("lon"));
                                    mo.position(latlon);
                                    final Bitmap icon;

                                    if (Friends.faces.containsKey(fname)) {
                                        icon = Friends.faces.get(fname);
                                    } else {
                                        icon = Const.nullpic;
                                        // If the friend's icon is not already cached, try to download it
                                        new Thread(new Runnable() {
                                            @Override
                                            public void run() {
                                                try {
                                                    JSONObject jsob = new JSONObject();
                                                    jsob.put("uname", Const.uname);
                                                    jsob.put("passwd", Const.passwd);
                                                    jsob.put("fname", fname);

                                                    Bitmap bmp = Network.getpic(jsob.toString());
                                                    Friends.faces.put(fname, Const.getCroppedBitmap(bmp, bmp.getWidth()));
                                                } catch (Exception e) {
                                                    System.out.println("error doInBackground(): GetLit" + e.getMessage());
                                                }
                                            }
                                        }).start();
                                    }

                                    float zoom = Const.googleMap.getCameraPosition().zoom;
                                    int side = Const.scaleSize(zoom);
                                    mo.icon(BitmapDescriptorFactory.fromBitmap(Bitmap.createScaledBitmap(icon, side, side, false)));

                                    if (oldMarkers != null) {
                                        if (oldMarkers.containsKey(fname) && oldMarkers.get(fname) != null) {
                                            Marker oldm = oldMarkers.get(fname);
                                            if (oldm.getPosition().equals(latlon) && oldZoom == zoom) {
                                                newMarkers.put(fname, oldm);
                                                oldMarkers.remove(fname);
                                            } else {
                                                boolean b = oldm.isInfoWindowShown();
                                                oldm.remove();
                                                oldMarkers.remove(fname);
                                                Marker newm = Const.googleMap.addMarker(mo);
                                                newMarkers.put(fname, newm);
                                                if (b)
                                                    newm.showInfoWindow();
                                            }
                                        } else {
                                            newMarkers.put(fname, Const.googleMap.addMarker(mo));
                                        }
                                    } else {
                                        newMarkers.put(fname, Const.googleMap.addMarker(mo));
                                    }
                                }
                                if (oldMarkers != null)
                                    for (Marker m : oldMarkers.values())
                                        if (m != null)
                                            m.remove();
                                oldMarkers = newMarkers;
                                oldZoom = Const.googleMap.getCameraPosition().zoom;
                            } catch (Exception e) {
                                System.out.println("error doInBackground(): GetLit " + e.getMessage());
                            }
                        }
                    });
                }
            } catch (Exception e) {
                System.out.println("error doInBackground(): GetLit " + e.getMessage());
            }
        }
        return null;
    }
}


text:
title: Choosing a VPN Service
categories:
- Security
- Privacy
tags:
- vpn
# https://github.com/mullvad/mullvadvpn-app/blob/master/graphics/icon.svg
thumbnail: thumbnail.svg
---

The entire process and tough criteria I went through to pick a VPN provider and escape mass surveillance.

<!-- more -->

## Criteria

Picking a VPN provider and going on my way merry way around the Internet is a pipe dream. Speed, privacy and tracking are still a concern.

When picking a provider I had a few things I needed:

- [Not part of the fourteen eyes](https://restoreprivacy.com/5-eyes-9-eyes-14-eyes/): This throws out a bunch of names like PIA and ExpressVPN (they're not great either). Even though PIA has proved themselves in court, I have suspicions the Government is playing 4D chess by making this VPN so popular.
- Sydney servers: Close to home, faster speeds and lower ping
- At least 100Mbp/s download: I'm testing this via speedtest.net. Not the most scientific.
- P2P allowed
- At least >=3 connections allowed at once. One for OPNsense, one for my mobile and another one just in case I need it
- No bandwidth logs, timestamp logs, IP address logs, DNS requests, traffic logs. No logs.
- OpenVPN support

Each provider has their own privacy concerns, if staying secure from your ISP wasn't enough you have to make sure the VPN provider also doesn't know what you're doing.

## VPN Comparison

Luckily, the Internet comes to the rescue. All the criteria above can be filtered thanks to [That One Privacy Site](https://thatoneprivacysite.net/vpn-section/).

With the all the above filtering I was left with:

- [Boxpn](https://boxpn.com/)
- [Ivacy](https://www.ivacy.com/)
- [Proxy.sh](https://proxy.sh/)
- [VPN.ht](https://vpn.ht/)
- [ZorroVPN](https://zorrovpn.com/?lang=en)

I also extended the test out to VPNs within 'fourteen eyes' as recommended by [privacytools.io](https://www.privacytools.io/providers/vpn/) and was given:

- [Mullvad](https://mullvad.net/en/)
- [FrootVPN](https://frootvpn.com/)

## Speed Test

As unscientically as the come, the testing methodology was:

- <https://www.speedtest.net/>
- AARNet server
- Multi connections option
- 3 runs with an average taken

![](speedtest.PNG)

| Provider             | Ping | Download | Upload | Fourteen Eyes Country |
|----------------------|------|----------|--------|-----------------------|
| No VPN (Telstra)     | 11   | 115.71   | 5.06   | Five                  |
| BoxPN                | 12   | 88.1     | 4.7    | No                    |
| FrootVPN             | 12   | 95.87    | 4.68   | Fourteen              |
| Ivacy                | 12   | 110.11   | 4.93   | No                    |
| Mullvad Sydney 1     | 11   | 110.82   | 4.9    | Fourteen              |
| Mullvad Sydney 3     | 12   | 113.11   | 4.95   | Fourteen              |
| Proxy.sh Australia 1 | 0    | 0        | 0      | No                    |
| Proxy.sh Australia 2 | 13   | 31.82    | 4.48   | No                    |
| Proxy.sh Australia 3 | 0    | 0        | 0      | No                    |
| Proxy.sh Australia 4 | 15   | 21.57    | 4.3    | No                    |
| VPN.ht               | 121  | 98.6     | 2.91   | No                    |
| ZorroVPN             | 13   | 65.19    | 4.9    | No                    |

As I mentioned before, I wanted at least 100Mbps download and the providers that met that were:

- Ivacy
- Mullvad

## Refund Policy

Luckily for me, each VPN provider listed had a money-back guarantee which I took them upon. This was used as an indicator of how ethical they were. I paid using PayPal so I could use them to step in for a refund if needed.

| Provider | Days to refund  | Time taken |
|----------|-----------------|------------|
| BoxPN    | 7               | 1          |
| FrootVPN | 30              | 2          |
| Ivacy    | 30              | 1          |
| Mullvad  | 0 (1 day trial) | 0          |
| Proxy.sh | 7               | TBA        |
| VPN.ht   | 30              | 1          |
| ZorroVPN | 7               | TBA        |

## The Decision

It came down to **Ivacy** or **Mullvad** due to speed.

Mullvad comes [highly commended](https://thatoneprivacysite.net/2017/10/03/mullvad-review/). My only concern is it's part of the fourteen eyes but both That One Privacy Guy and privacytools.io are okay with that. Mullvad do [clearly outline how they don't log any info](https://mullvad.net/en/guides/no-logging-data-policy/), but saying what you do and doing it can be different. This is still better than 99% of providers that just write 'we don't log'.

Ivacy on the otherhand is a bit sketchy. They [tried bribing That One Privacy Guy](https://thatoneprivacysite.net/2016/05/24/old-the-story-of-how-a-certain-vpn-company-tried-bribing-me/). Ivacy is also a sub-brand/rebrand of PureVPN, which is a provider that has been [busted keeping logs](https://www.bleepingcomputer.com/news/security/cyberstalking-suspect-arrested-after-vpn-providers-shared-logs-with-the-fbi/). So in reality, Ivacy does keep logs as PureVPN keep logs. **Stay away.**

There is no perfect answer, but **Mullvad** is as close as it comes. My reason for a VPN is to escape mass surveillance. Mullvad keeps no logs, provides strong encryption, offers great speeds and are big on anonymity. While being in the 'fourteen eyes' is a concern, there isn't anything stopping anybody from starting a VPN company in any other country either. My criteria was at least not within the 'five' or 'nine' eyes.

redpajama_set_name: RedPajamaGithub


text:
<manageDatabaseRLY>
  <completionInformation>
    <returnCode>OK</returnCode>
  </completionInformation>
  <results>
    <result item="1">
      <result>
        <fielddefinition>
          <field name="TKEY" type="INTEGER" columnDisplaySize="11" precision="32" scale="0" isCurrency="false" columnTypeName="INTEGER" columnClassName="java.lang.Integer"/>
          <field name="TCHAR" type="CHAR" columnDisplaySize="1" precision="1" scale="0" isCurrency="false" columnTypeName="CHARACTER" columnClassName="java.lang.String"/>
          <field name="TTIMESTAMP" type="TIMESTAMP" columnDisplaySize="26" precision="26" scale="6" isCurrency="false" columnTypeName="TIMESTAMP" columnClassName="java.sql.Timestamp"/>
          <field name="TVARCHAR" type="VARCHAR" columnDisplaySize="100" precision="100" scale="0" isCurrency="false" columnTypeName="CHARACTER VARYING" columnClassName="java.lang.String"/>
        </fielddefinition>
        <rowset>
          <row number="0">
            <field name="TKEY">57438</field>
            <field name="TCHAR">D</field>
            <field name="TTIMESTAMP">2022-01-20 17:48:59</field>
            <field name="TVARCHAR" null="true"/>
          </row>
          <row number="1">
            <field name="TKEY">57439</field>
            <field name="TCHAR">T</field>
            <field name="TTIMESTAMP" null="true"/>
            <field name="TVARCHAR" null="true"/>
          </row>
        </rowset>
      </result>
    </result>
  </results>
</manageDatabaseRLY>


text:
from SPyFFI.Observation import Observation, default

# start from the default settings
inputs = default

inputs['camera']['label'] = 'soren'
inputs['catalog']['name'] = 'testpattern'
inputs['camera']['subarray'] = None
inputs['camera']['variablefocus'] = False
inputs['expose']['jitterscale'] = 1.0
inputs['expose']['skipcosmics'] = True
inputs['catalog']['testpatternkw']['randomizemagnitudes'] = True
inputs['observation']['cadencestodo'] = {1800:9}#, 120:16, 1800:16}
o = Observation(inputs)

o.create()


text:
package org.powermock.api.mockito.repackaged.cglib.core;

/**
 * The default policy used by {@link AbstractClassGenerator}.
 * Generates names such as
 * <p>{@code org.powermock.api.mockito.repackaged.cglib.Foo$$EnhancerByCGLIB$$38272841}<p>
 * This is composed of a prefix based on the name of the superclass, a fixed
 * string incorporating the CGLIB class responsible for generation, and a
 * hashcode derived from the parameters used to create the object. If the same
 * name has been previously been used in the same {@code ClassLoader}, a
 * suffix is added to ensure uniqueness.
 */
public class DefaultNamingPolicy implements NamingPolicy {
    public static final DefaultNamingPolicy INSTANCE = new DefaultNamingPolicy();

    public String getClassName(String prefix, String source, Object key, Predicate names) {
        if (prefix == null) {
            prefix = "org.powermock.api.mockito.repackaged.cglib.empty.Object";
        } else if (prefix.startsWith("java")) {
            prefix = "$" + prefix;
        }
        String base =
            prefix + "$$" +
            source.substring(source.lastIndexOf('.') + 1) +
            getTag() + "$$" +
            Integer.toHexString(key.hashCode());
        String attempt = base;
        int index = 2;
        while (names.evaluate(attempt))
            attempt = base + "_" + index++;
        return attempt;
    }

    /**
     * Returns a string which is incorporated into every generated class name.
     * By default returns "ByCGLIB"
     */
    protected String getTag() {
        return "ByCGLIB";
    }
}


text:
namespace i18n {
namespace addressinput {

class Retriever;
class Rule;

// Retrieves validation rules. Sample usage:
//    const Retriever* retriever = ...
//    RuleRetriever rules(retriever);
//    const std::unique_ptr<const RuleRetriever::Callback> rule_ready(
//        BuildCallback(this, &MyClass::OnRuleReady));
//    rules.RetrieveRule("data/CA/AB--fr", *rule_ready);
class RuleRetriever {
 public:
  typedef i18n::addressinput::Callback<const std::string&,
                                       const Rule&> Callback;

  RuleRetriever(const RuleRetriever&) = delete;
  RuleRetriever& operator=(const RuleRetriever&) = delete;

  // Takes ownership of |retriever|.
  explicit RuleRetriever(const Retriever* retriever);
  ~RuleRetriever();

  // Retrieves the rule for |key| and invokes the |rule_ready| callback.
  void RetrieveRule(const std::string& key, const Callback& rule_ready) const;

 private:
  std::unique_ptr<const Retriever> data_retriever_;
};

}  // namespace addressinput
}  // namespace i18n

#endif  // I18N_ADDRESSINPUT_RULE_RETRIEVER_H_


text:
'use strict';

angular.module('pokertrainerwebApp.util', []);


text:
angular.module('IssueTracker.users.identity', [
    'IssueTracker.users.authentication'
])

    .factory('identity', [
        '$http',
        '$q',
        'BASE_URL',
        'authentication',
        function($http,$q,BASE_URL,authentication) {

            function getCurrentUser() {
                var deferred = $q.defer();

                var request = {
                    method: 'GET',
                    url: BASE_URL + 'users/me',
                    headers: {'Authorization': 'Bearer ' + sessionStorage.authToken}
                };

                $http(request)
                    .then(function(response) {
                        deferred.resolve(response.data);
                    }, function(err) {
                        deferred.reject(err);
                    });

                return deferred.promise;
            }

            function isAdmin() {
                if(sessionStorage['currentUser']) {
                    var current = JSON.parse(sessionStorage.currentUser);;
                    return current.isAdmin;
                }
            }

            function hasLoggedUser() {
                return sessionStorage.authToken !== undefined;
            }

            return {
                getCurrentUser: getCurrentUser,
                hasLoggedUser: hasLoggedUser,
                isAdmin: isAdmin
            }
        }
    ]);


text:
<!DOCTYPE html>

<TITLE>Manpage of PERLTIE</TITLE>
<meta charset="utf-8">
<link rel="stylesheet" href="/css/main.css" type="text/css">

linux manpages

{"type":"documentation"}

PERLTIE

Section: Perl Programmers Reference Guide (1)
Updated: 2009-05-06
Index
Return to Main Contents

NAME

perltie - how to hide an object class in a simple variable

SYNOPSIS

 tie VARIABLE, CLASSNAME, LIST

 $object = tied VARIABLE

 untie VARIABLE

DESCRIPTION

Prior to release 5.0 of Perl, a programmer could use dbmopen()
to connect an on-disk database in the standard Unix dbm(3x)
format magically to a <TT>%HASH</TT> in their program.  However, their Perl was either
built with one particular dbm library or another, but not both, and
you couldn't extend this mechanism to other packages or types of variables.

Now you can.

The tie() function binds a variable to a class (package) that will provide
the implementation for access methods for that variable.  Once this magic
has been performed, accessing a tied variable automatically triggers
method calls in the proper class.  The complexity of the class is
hidden behind magic methods calls.  The method names are in ALL CAPS,
which is a convention that Perl uses to indicate that they're called
implicitly rather than explicitly---just like the BEGIN() and END()
functions.

In the tie() call, <TT>"VARIABLE"</TT> is the name of the variable to be
enchanted.  <TT>"CLASSNAME"</TT> is the name of a class implementing objects of
the correct type.  Any additional arguments in the <TT>"LIST"</TT> are passed to
the appropriate constructor method for that class---meaning TIESCALAR(),
TIEARRAY(), TIEHASH(), or TIEHANDLE().  (Typically these are arguments
such as might be passed to the dbminit() function of C.) The object
returned by the ``new'' method is also returned by the tie() function,
which would be useful if you wanted to access other methods in
<TT>"CLASSNAME"</TT>. (You don't actually have to return a reference to a right
``type'' (e.g., HASH or <TT>"CLASSNAME"</TT>) so long as it's a properly blessed
object.)  You can also retrieve a reference to the underlying object
using the tied() function.

Unlike dbmopen(), the tie() function will not <TT>"use"</TT> or <TT>"require"</TT> a module
for you---you need to do that explicitly yourself.

Tying Scalars

A class implementing a tied scalar should define the following methods:
TIESCALAR, FETCH, STORE, and possibly UNTIE and/or DESTROY.

Let's look at each in turn, using as an example a tie class for
scalars that allows the user to do something like:

    tie $his_speed, 'Nice', getppid();
    tie $my_speed,  'Nice', $$;

And now whenever either of those variables is accessed, its current
system priority is retrieved and returned.  If those variables are set,
then the process's priority is changed!

We'll use Jarkko Hietaniemi <jhi@iki.fi>'s BSD::Resource class (not
included) to access the PRIO_PROCESS, PRIO_MIN, and PRIO_MAX constants
from your system, as well as the getpriority() and setpriority() system
calls.  Here's the preamble of the class.

    package Nice;
    use Carp;
    use BSD::Resource;
    use strict;
    $Nice::DEBUG = 0 unless defined $Nice::DEBUG;

TIESCALAR classname, LIST

This is the constructor for the class.  That means it is
expected to return a blessed reference to a new scalar
(probably anonymous) that it's creating.  For example:

    sub TIESCALAR {
        my $class = shift;
        my $pid = shift || $$; # 0 means me

        if ($pid !~ /^\d+$/) {
            carp "Nice::Tie::Scalar got non-numeric pid $pid" if $^W;
            return undef;
        }

        unless (kill 0, $pid) { # EPERM or ERSCH, no doubt
            carp "Nice::Tie::Scalar got bad pid $pid: $!" if $^W;
            return undef;
        }

        return bless \$pid, $class;
    }

This tie class has chosen to return an error rather than raising an
exception if its constructor should fail.  While this is how dbmopen() works,
other classes may well not wish to be so forgiving.  It checks the global
variable <TT>$^W</TT> to see whether to emit a bit of noise anyway.

FETCH this

This method will be triggered every time the tied variable is accessed
(read).  It takes no arguments beyond its self reference, which is the
object representing the scalar we're dealing with.  Because in this case
we're using just a SCALAR ref for the tied scalar object, a simple $$self
allows the method to get at the real value stored there.  In our example
below, that real value is the process ID to which we've tied our variable.

    sub FETCH {
        my $self = shift;
        confess "wrong type" unless ref $self;
        croak "usage error" if @_;
        my $nicety;
        local($!) = 0;
        $nicety = getpriority(PRIO_PROCESS, $$self);
        if ($!) { croak "getpriority failed: $!" }
        return $nicety;
    }

This time we've decided to blow up (raise an exception) if the renice
fails---there's no place for us to return an error otherwise, and it's
probably the right thing to do.

STORE this, value

This method will be triggered every time the tied variable is set
(assigned).  Beyond its self reference, it also expects one (and only one)
argument---the new value the user is trying to assign. Don't worry about
returning a value from STORE --- the semantic of assignment returning the
assigned value is implemented with FETCH.

    sub STORE {
        my $self = shift;
        confess "wrong type" unless ref $self;
        my $new_nicety = shift;
        croak "usage error" if @_;

        if ($new_nicety < PRIO_MIN) {
            carp sprintf
              "WARNING: priority %d less than minimum system priority %d",
                  $new_nicety, PRIO_MIN if $^W;
            $new_nicety = PRIO_MIN;
        }

        if ($new_nicety > PRIO_MAX) {
            carp sprintf
              "WARNING: priority %d greater than maximum system priority %d",
                  $new_nicety, PRIO_MAX if $^W;
            $new_nicety = PRIO_MAX;
        }

        unless (defined setpriority(PRIO_PROCESS, $$self, $new_nicety)) {
            confess "setpriority failed: $!";
        }
    }

UNTIE this

This method will be triggered when the <TT>"untie"</TT> occurs. This can be useful
if the class needs to know when no further calls will be made. (Except DESTROY
of course.) See "The <TT>"untie"</TT> Gotcha" below for more details.

DESTROY this

This method will be triggered when the tied variable needs to be destructed.
As with other object classes, such a method is seldom necessary, because Perl
deallocates its moribund object's memory for you automatically---this isn't
C++, you know.  We'll use a DESTROY method here for debugging purposes only.

    sub DESTROY {
        my $self = shift;
        confess "wrong type" unless ref $self;
        carp "[ Nice::DESTROY pid $$self ]" if $Nice::DEBUG;
    }

That's about all there is to it.  Actually, it's more than all there
is to it, because we've done a few nice things here for the sake
of completeness, robustness, and general aesthetics.  Simpler
TIESCALAR classes are certainly possible.

Tying Arrays

A class implementing a tied ordinary array should define the following
methods: TIEARRAY, FETCH, STORE, FETCHSIZE, STORESIZE and perhaps UNTIE and/or DESTROY.

FETCHSIZE and STORESIZE are used to provide <TT>$#array</TT> and
equivalent <TT>"scalar(@array)"</TT> access.

The methods POP, PUSH, SHIFT, UNSHIFT, SPLICE, DELETE, and EXISTS are
required if the perl operator with the corresponding (but lowercase) name
is to operate on the tied array. The Tie::Array class can be used as a
base class to implement the first five of these in terms of the basic
methods above.  The default implementations of DELETE and EXISTS in
Tie::Array simply <TT>"croak"</TT>.

In addition EXTEND will be called when perl would have pre-extended
allocation in a real array.

For this discussion, we'll implement an array whose elements are a fixed
size at creation.  If you try to create an element larger than the fixed
size, you'll take an exception.  For example:

    use FixedElem_Array;
    tie @array, 'FixedElem_Array', 3;
    $array[0] = 'cat';  # ok.
    $array[1] = 'dogs'; # exception, length('dogs') > 3.

The preamble code for the class is as follows:

    package FixedElem_Array;
    use Carp;
    use strict;

TIEARRAY classname, LIST

This is the constructor for the class.  That means it is expected to
return a blessed reference through which the new array (probably an
anonymous ARRAY ref) will be accessed.

In our example, just to show you that you don't really have to return an
ARRAY reference, we'll choose a HASH reference to represent our object.
A HASH works out well as a generic record type: the <TT>"{ELEMSIZE}"</TT> field will
store the maximum element size allowed, and the <TT>"{ARRAY}"</TT> field will hold the
true ARRAY ref.  If someone outside the class tries to dereference the
object returned (doubtless thinking it an ARRAY ref), they'll blow up.
This just goes to show you that you should respect an object's privacy.

    sub TIEARRAY {
      my $class    = shift;
      my $elemsize = shift;
      if ( @_ || $elemsize =~ /\D/ ) {
        croak "usage: tie ARRAY, '" . __PACKAGE__ . "', elem_size";
      }
      return bless {
        ELEMSIZE => $elemsize,
        ARRAY    => [],
      }, $class;
    }

FETCH this, index

This method will be triggered every time an individual element the tied array
is accessed (read).  It takes one argument beyond its self reference: the
index whose value we're trying to fetch.

    sub FETCH {
      my $self  = shift;
      my $index = shift;
      return $self->{ARRAY}->[$index];
    }

If a negative array index is used to read from an array, the index
will be translated to a positive one internally by calling FETCHSIZE
before being passed to FETCH.  You may disable this feature by
assigning a true value to the variable <TT>$NEGATIVE_INDICES</TT> in the
tied array class.

As you may have noticed, the name of the FETCH method (et al.) is the same
for all accesses, even though the constructors differ in names (TIESCALAR
vs TIEARRAY).  While in theory you could have the same class servicing
several tied types, in practice this becomes cumbersome, and it's easiest
to keep them at simply one tie type per class.

STORE this, index, value

This method will be triggered every time an element in the tied array is set
(written).  It takes two arguments beyond its self reference: the index at
which we're trying to store something and the value we're trying to put
there.

In our example, <TT>"undef"</TT> is really <TT>"$self->{ELEMSIZE}"</TT> number of
spaces so we have a little more work to do here:

    sub STORE {
      my $self = shift;
      my( $index, $value ) = @_;
      if ( length $value > $self->{ELEMSIZE} ) {
        croak "length of $value is greater than $self->{ELEMSIZE}";
      }
      # fill in the blanks
      $self->EXTEND( $index ) if $index > $self->FETCHSIZE();
      # right justify to keep element size for smaller elements
      $self->{ARRAY}->[$index] = sprintf "%$self->{ELEMSIZE}s", $value;
    }

Negative indexes are treated the same as with FETCH.

FETCHSIZE this

Returns the total number of items in the tied array associated with
object this. (Equivalent to <TT>"scalar(@array)"</TT>).  For example:

    sub FETCHSIZE {
      my $self = shift;
      return scalar @{$self->{ARRAY}};
    }

STORESIZE this, count

Sets the total number of items in the tied array associated with
object this to be count. If this makes the array larger then
class's mapping of <TT>"undef"</TT> should be returned for new positions.
If the array becomes smaller then entries beyond count should be
deleted.

In our example, 'undef' is really an element containing
<TT>"$self->{ELEMSIZE}"</TT> number of spaces.  Observe:

    sub STORESIZE {
      my $self  = shift;
      my $count = shift;
      if ( $count > $self->FETCHSIZE() ) {
        foreach ( $count - $self->FETCHSIZE() .. $count ) {
          $self->STORE( $_, '' );
        }
      } elsif ( $count < $self->FETCHSIZE() ) {
        foreach ( 0 .. $self->FETCHSIZE() - $count - 2 ) {
          $self->POP();
        }
      }
    }

EXTEND this, count

Informative call that array is likely to grow to have count entries.
Can be used to optimize allocation. This method need do nothing.

In our example, we want to make sure there are no blank (<TT>"undef"</TT>)
entries, so <TT>"EXTEND"</TT> will make use of <TT>"STORESIZE"</TT> to fill elements
as needed:

    sub EXTEND {
      my $self  = shift;
      my $count = shift;
      $self->STORESIZE( $count );
    }

EXISTS this, key

Verify that the element at index key exists in the tied array this.

In our example, we will determine that if an element consists of
<TT>"$self->{ELEMSIZE}"</TT> spaces only, it does not exist:

    sub EXISTS {
      my $self  = shift;
      my $index = shift;
      return 0 if ! defined $self->{ARRAY}->[$index] ||
                  $self->{ARRAY}->[$index] eq ' ' x $self->{ELEMSIZE};
      return 1;
    }

DELETE this, key

Delete the element at index key from the tied array this.

In our example, a deleted item is <TT>"$self->{ELEMSIZE}"</TT> spaces:

    sub DELETE {
      my $self  = shift;
      my $index = shift;
      return $self->STORE( $index, '' );
    }

CLEAR this

Clear (remove, delete, ...) all values from the tied array associated with
object this.  For example:

    sub CLEAR {
      my $self = shift;
      return $self->{ARRAY} = [];
    }

PUSH this, LIST

Append elements of LIST to the array.  For example:

    sub PUSH {
      my $self = shift;
      my @list = @_;
      my $last = $self->FETCHSIZE();
      $self->STORE( $last + $_, $list[$_] ) foreach 0 .. $#list;
      return $self->FETCHSIZE();
    }

POP this

Remove last element of the array and return it.  For example:

    sub POP {
      my $self = shift;
      return pop @{$self->{ARRAY}};
    }

SHIFT this

Remove the first element of the array (shifting other elements down)
and return it.  For example:

    sub SHIFT {
      my $self = shift;
      return shift @{$self->{ARRAY}};
    }

UNSHIFT this, LIST

Insert LIST elements at the beginning of the array, moving existing elements
up to make room.  For example:

    sub UNSHIFT {
      my $self = shift;
      my @list = @_;
      my $size = scalar( @list );
      # make room for our list
      @{$self->{ARRAY}}[ $size .. $#{$self->{ARRAY}} + $size ]
       = @{$self->{ARRAY}};
      $self->STORE( $_, $list[$_] ) foreach 0 .. $#list;
    }

SPLICE this, offset, length, LIST

Perform the equivalent of <TT>"splice"</TT> on the array.

offset is optional and defaults to zero, negative values count back
from the end of the array.

length is optional and defaults to rest of the array.

LIST may be empty.

Returns a list of the original length elements at offset.

In our example, we'll use a little shortcut if there is a LIST:

    sub SPLICE {
      my $self   = shift;
      my $offset = shift || 0;
      my $length = shift || $self->FETCHSIZE() - $offset;
      my @list   = ();
      if ( @_ ) {
        tie @list, __PACKAGE__, $self->{ELEMSIZE};
        @list   = @_;
      }
      return splice @{$self->{ARRAY}}, $offset, $length, @list;
    }

UNTIE this

Will be called when <TT>"untie"</TT> happens. (See "The <TT>"untie"</TT> Gotcha" below.)

DESTROY this

This method will be triggered when the tied variable needs to be destructed.
As with the scalar tie class, this is almost never needed in a
language that does its own garbage collection, so this time we'll
just leave it out.

Tying Hashes

Hashes were the first Perl data type to be tied (see dbmopen()).  A class
implementing a tied hash should define the following methods: TIEHASH is
the constructor.  FETCH and STORE access the key and value pairs.  EXISTS
reports whether a key is present in the hash, and DELETE deletes one.
CLEAR empties the hash by deleting all the key and value pairs.  FIRSTKEY
and NEXTKEY implement the keys() and each() functions to iterate over all
the keys. SCALAR is triggered when the tied hash is evaluated in scalar
context. UNTIE is called when <TT>"untie"</TT> happens, and DESTROY is called when
the tied variable is garbage collected.

If this seems like a lot, then feel free to inherit from merely the
standard Tie::StdHash module for most of your methods, redefining only the
interesting ones.  See Tie::Hash for details.

Remember that Perl distinguishes between a key not existing in the hash,
and the key existing in the hash but having a corresponding value of
<TT>"undef"</TT>.  The two possibilities can be tested with the <TT>"exists()"</TT> and
<TT>"defined()"</TT> functions.

Here's an example of a somewhat interesting tied hash class:  it gives you
a hash representing a particular user's dot files.  You index into the hash
with the name of the file (minus the dot) and you get back that dot file's
contents.  For example:

    use DotFiles;
    tie %dot, 'DotFiles';
    if ( $dot{profile} =~ /MANPATH/ ||
         $dot{login}   =~ /MANPATH/ ||
         $dot{cshrc}   =~ /MANPATH/    )
    {
        print "you seem to set your MANPATH\n";
    }

Or here's another sample of using our tied class:

    tie %him, 'DotFiles', 'daemon';
    foreach $f ( keys %him ) {
        printf "daemon dot file %s is size %d\n",
            $f, length $him{$f};
    }

In our tied hash DotFiles example, we use a regular
hash for the object containing several important
fields, of which only the <TT>"{LIST}"</TT> field will be what the
user thinks of as the real hash.

USER

whose dot files this object represents

HOME

where those dot files live

CLOBBER

whether we should try to change or remove those dot files

LIST

the hash of dot file names and content mappings

Here's the start of Dotfiles.pm:

    package DotFiles;
    use Carp;
    sub whowasi { (caller(1))[3] . '()' }
    my $DEBUG = 0;
    sub debug { $DEBUG = @_ ? shift : 1 }

For our example, we want to be able to emit debugging info to help in tracing
during development.  We keep also one convenience function around
internally to help print out warnings; whowasi() returns the function name
that calls it.

Here are the methods for the DotFiles tied hash.

TIEHASH classname, LIST

This is the constructor for the class.  That means it is expected to
return a blessed reference through which the new object (probably but not
necessarily an anonymous hash) will be accessed.

Here's the constructor:

    sub TIEHASH {
        my $self = shift;
        my $user = shift || $>;
        my $dotdir = shift || '';
        croak "usage: @{[&whowasi]} [USER [DOTDIR]]" if @_;
        $user = getpwuid($user) if $user =~ /^\d+$/;
        my $dir = (getpwnam($user))[7]
                || croak "@{[&whowasi]}: no user $user";
        $dir .= "/$dotdir" if $dotdir;

        my $node = {
            USER    => $user,
            HOME    => $dir,
            LIST    => {},
            CLOBBER => 0,
        };

        opendir(DIR, $dir)
                || croak "@{[&whowasi]}: can't opendir $dir: $!";
        foreach $dot ( grep /^\./ && -f "$dir/$_", readdir(DIR)) {
            $dot =~ s/^\.//;
            $node->{LIST}{$dot} = undef;
        }
        closedir DIR;
        return bless $node, $self;
    }

It's probably worth mentioning that if you're going to filetest the
return values out of a readdir, you'd better prepend the directory
in question.  Otherwise, because we didn't chdir() there, it would
have been testing the wrong file.

FETCH this, key

This method will be triggered every time an element in the tied hash is
accessed (read).  It takes one argument beyond its self reference: the key
whose value we're trying to fetch.

Here's the fetch for our DotFiles example.

    sub FETCH {
        carp &whowasi if $DEBUG;
        my $self = shift;
        my $dot = shift;
        my $dir = $self->{HOME};
        my $file = "$dir/.$dot";

        unless (exists $self->{LIST}->{$dot} || -f $file) {
            carp "@{[&whowasi]}: no $dot file" if $DEBUG;
            return undef;
        }

        if (defined $self->{LIST}->{$dot}) {
            return $self->{LIST}->{$dot};
        } else {
            return $self->{LIST}->{$dot} = `cat $dir/.$dot`;
        }
    }

It was easy to write by having it call the Unix cat(1) command, but it
would probably be more portable to open the file manually (and somewhat
more efficient).  Of course, because dot files are a Unixy concept, we're
not that concerned.

STORE this, key, value

This method will be triggered every time an element in the tied hash is set
(written).  It takes two arguments beyond its self reference: the index at
which we're trying to store something, and the value we're trying to put
there.

Here in our DotFiles example, we'll be careful not to let
them try to overwrite the file unless they've called the clobber()
method on the original object reference returned by tie().

    sub STORE {
        carp &whowasi if $DEBUG;
        my $self = shift;
        my $dot = shift;
        my $value = shift;
        my $file = $self->{HOME} . "/.$dot";
        my $user = $self->{USER};

        croak "@{[&whowasi]}: $file not clobberable"
            unless $self->{CLOBBER};

        open(F, "> $file") || croak "can't open $file: $!";
        print F $value;
        close(F);
    }

If they wanted to clobber something, they might say:

    $ob = tie %daemon_dots, 'daemon';
    $ob->clobber(1);
    $daemon_dots{signature} = "A true daemon\n";

Another way to lay hands on a reference to the underlying object is to
use the tied() function, so they might alternately have set clobber
using:

    tie %daemon_dots, 'daemon';
    tied(%daemon_dots)->clobber(1);

The clobber method is simply:

    sub clobber {
        my $self = shift;
        $self->{CLOBBER} = @_ ? shift : 1;
    }

DELETE this, key

This method is triggered when we remove an element from the hash,
typically by using the delete() function.  Again, we'll
be careful to check whether they really want to clobber files.

    sub DELETE   {
        carp &whowasi if $DEBUG;

        my $self = shift;
        my $dot = shift;
        my $file = $self->{HOME} . "/.$dot";
        croak "@{[&whowasi]}: won't remove file $file"
            unless $self->{CLOBBER};
        delete $self->{LIST}->{$dot};
        my $success = unlink($file);
        carp "@{[&whowasi]}: can't unlink $file: $!" unless $success;
        $success;
    }

The value returned by DELETE becomes the return value of the call
to delete().  If you want to emulate the normal behavior of delete(),
you should return whatever FETCH would have returned for this key.
In this example, we have chosen instead to return a value which tells
the caller whether the file was successfully deleted.

CLEAR this

This method is triggered when the whole hash is to be cleared, usually by
assigning the empty list to it.

In our example, that would remove all the user's dot files!  It's such a
dangerous thing that they'll have to set CLOBBER to something higher than
1 to make it happen.

    sub CLEAR    {
        carp &whowasi if $DEBUG;
        my $self = shift;
        croak "@{[&whowasi]}: won't remove all dot files for $self->{USER}"
            unless $self->{CLOBBER} > 1;
        my $dot;
        foreach $dot ( keys %{$self->{LIST}}) {
            $self->DELETE($dot);
        }
    }

EXISTS this, key

This method is triggered when the user uses the exists() function
on a particular hash.  In our example, we'll look at the <TT>"{LIST}"</TT>
hash element for this:

    sub EXISTS   {
        carp &whowasi if $DEBUG;
        my $self = shift;
        my $dot = shift;
        return exists $self->{LIST}->{$dot};
    }

FIRSTKEY this

This method will be triggered when the user is going
to iterate through the hash, such as via a keys() or each()
call.

    sub FIRSTKEY {
        carp &whowasi if $DEBUG;
        my $self = shift;
        my $a = keys %{$self->{LIST}};          # reset each() iterator
        each %{$self->{LIST}}
    }

NEXTKEY this, lastkey

This method gets triggered during a keys() or each() iteration.  It has a
second argument which is the last key that had been accessed.  This is
useful if you're carrying about ordering or calling the iterator from more
than one sequence, or not really storing things in a hash anywhere.

For our example, we're using a real hash so we'll do just the simple
thing, but we'll have to go through the LIST field indirectly.

    sub NEXTKEY  {
        carp &whowasi if $DEBUG;
        my $self = shift;
        return each %{ $self->{LIST} }
    }

SCALAR this

This is called when the hash is evaluated in scalar context. In order
to mimic the behaviour of untied hashes, this method should return a
false value when the tied hash is considered empty. If this method does
not exist, perl will make some educated guesses and return true when
the hash is inside an iteration. If this isn't the case, FIRSTKEY is
called, and the result will be a false value if FIRSTKEY returns the empty
list, true otherwise.

However, you should not blindly rely on perl always doing the right
thing. Particularly, perl will mistakenly return true when you clear the
hash by repeatedly calling DELETE until it is empty. You are therefore
advised to supply your own SCALAR method when you want to be absolutely
sure that your hash behaves nicely in scalar context.

In our example we can just call <TT>"scalar"</TT> on the underlying hash
referenced by <TT>"$self->{LIST}"</TT>:

    sub SCALAR {
        carp &whowasi if $DEBUG;
        my $self = shift;
        return scalar %{ $self->{LIST} }
    }

UNTIE this

This is called when <TT>"untie"</TT> occurs.  See "The <TT>"untie"</TT> Gotcha" below.

DESTROY this

This method is triggered when a tied hash is about to go out of
scope.  You don't really need it unless you're trying to add debugging
or have auxiliary state to clean up.  Here's a very simple function:

    sub DESTROY  {
        carp &whowasi if $DEBUG;
    }

Note that functions such as keys() and values() may return huge lists
when used on large objects, like DBM files.  You may prefer to use the
each() function to iterate over such.  Example:

    # print out history file offsets
    use NDBM_File;
    tie(%HIST, 'NDBM_File', '/usr/lib/news/history', 1, 0);
    while (($key,$val) = each %HIST) {
        print $key, ' = ', unpack('L',$val), "\n";
    }
    untie(%HIST);

Tying FileHandles

This is partially implemented now.

A class implementing a tied filehandle should define the following
methods: TIEHANDLE, at least one of PRINT, PRINTF, WRITE, READLINE, GETC,
READ, and possibly CLOSE, UNTIE and DESTROY.  The class can also provide: BINMODE,
OPEN, EOF, FILENO, SEEK, TELL - if the corresponding perl operators are
used on the handle.

When STDERR is tied, its PRINT method will be called to issue warnings
and error messages.  This feature is temporarily disabled during the call,
which means you can use <TT>"warn()"</TT> inside PRINT without starting a recursive
loop.  And just like <TT>"__WARN__"</TT> and <TT>"__DIE__"</TT> handlers, STDERR's PRINT
method may be called to report parser errors, so the caveats mentioned under
``%SIG'' in perlvar apply.

All of this is especially useful when perl is embedded in some other
program, where output to STDOUT and STDERR may have to be redirected
in some special way.  See nvi and the Apache module for examples.

In our example we're going to create a shouting handle.

    package Shout;

TIEHANDLE classname, LIST

This is the constructor for the class.  That means it is expected to
return a blessed reference of some sort. The reference can be used to
hold some internal information.

    sub TIEHANDLE { print "<shout>\n"; my $i; bless \$i, shift }

WRITE this, LIST

This method will be called when the handle is written to via the
<TT>"syswrite"</TT> function.

    sub WRITE {
        $r = shift;
        my($buf,$len,$offset) = @_;
        print "WRITE called, \$buf=$buf, \$len=$len, \$offset=$offset";
    }

PRINT this, LIST

This method will be triggered every time the tied handle is printed to
with the <TT>"print()"</TT> or <TT>"say()"</TT> functions.  Beyond its self reference
it also expects the list that was passed to the print function.

    sub PRINT { $r = shift; $$r++; print join($,,map(uc($_),@_)),$\ }

<TT>"say()"</TT> acts just like <TT>"print()"</TT> except $\ will be localized to <TT>"\n"</TT> so
you need do nothing special to handle <TT>"say()"</TT> in <TT>"PRINT()"</TT>.

PRINTF this, LIST

This method will be triggered every time the tied handle is printed to
with the <TT>"printf()"</TT> function.
Beyond its self reference it also expects the format and list that was
passed to the printf function.

    sub PRINTF {
        shift;
        my $fmt = shift;
        print sprintf($fmt, @_);
    }

READ this, LIST

This method will be called when the handle is read from via the <TT>"read"</TT>
or <TT>"sysread"</TT> functions.

    sub READ {
        my $self = shift;
        my $bufref = \$_[0];
        my(undef,$len,$offset) = @_;
        print "READ called, \$buf=$bufref, \$len=$len, \$offset=$offset";
        # add to $$bufref, set $len to number of characters read
        $len;
    }

READLINE this

This method will be called when the handle is read from via <HANDLE>.
The method should return undef when there is no more data.

    sub READLINE { $r = shift; "READLINE called $$r times\n"; }

GETC this

This method will be called when the <TT>"getc"</TT> function is called.

    sub GETC { print "Don't GETC, Get Perl"; return "a"; }

CLOSE this

This method will be called when the handle is closed via the <TT>"close"</TT>
function.

    sub CLOSE { print "CLOSE called.\n" }

UNTIE this

As with the other types of ties, this method will be called when <TT>"untie"</TT> happens.
It may be appropriate to ``auto CLOSE'' when this occurs.  See
"The <TT>"untie"</TT> Gotcha" below.

DESTROY this

As with the other types of ties, this method will be called when the
tied handle is about to be destroyed. This is useful for debugging and
possibly cleaning up.

    sub DESTROY { print "</shout>\n" }

Here's how to use our little example:

    tie(*FOO,'Shout');
    print FOO "hello\n";
    $a = 4; $b = 6;
    print FOO $a, " plus ", $b, " equals ", $a + $b, "\n";
    print <FOO>;

UNTIE this

You can define for all tie types an UNTIE method that will be called
at untie().  See "The <TT>"untie"</TT> Gotcha" below.

The untie Gotcha

If you intend making use of the object returned from either tie() or
tied(), and if the tie's target class defines a destructor, there is a
subtle gotcha you must guard against.

As setup, consider this (admittedly rather contrived) example of a
tie; all it does is use a file to keep a log of the values assigned to
a scalar.

    package Remember;

    use strict;
    use warnings;
    use IO::File;

    sub TIESCALAR {
        my $class = shift;
        my $filename = shift;
        my $handle = IO::File->new( "> $filename" )
                         or die "Cannot open $filename: $!\n";

        print $handle "The Start\n";
        bless {FH => $handle, Value => 0}, $class;
    }

    sub FETCH {
        my $self = shift;
        return $self->{Value};
    }

    sub STORE {
        my $self = shift;
        my $value = shift;
        my $handle = $self->{FH};
        print $handle "$value\n";
        $self->{Value} = $value;
    }

    sub DESTROY {
        my $self = shift;
        my $handle = $self->{FH};
        print $handle "The End\n";
        close $handle;
    }

    1;

Here is an example that makes use of this tie:

    use strict;
    use Remember;

    my $fred;
    tie $fred, 'Remember', 'myfile.txt';
    $fred = 1;
    $fred = 4;
    $fred = 5;
    untie $fred;
    system "cat myfile.txt";

This is the output when it is executed:

    The Start
    1
    4
    5
    The End

So far so good.  Those of you who have been paying attention will have
spotted that the tied object hasn't been used so far.  So lets add an
extra method to the Remember class to allow comments to be included in
the file --- say, something like this:

    sub comment {
        my $self = shift;
        my $text = shift;
        my $handle = $self->{FH};
        print $handle $text, "\n";
    }

And here is the previous example modified to use the <TT>"comment"</TT> method
(which requires the tied object):

    use strict;
    use Remember;

    my ($fred, $x);
    $x = tie $fred, 'Remember', 'myfile.txt';
    $fred = 1;
    $fred = 4;
    comment $x "changing...";
    $fred = 5;
    untie $fred;
    system "cat myfile.txt";

When this code is executed there is no output.  Here's why:

When a variable is tied, it is associated with the object which is the
return value of the TIESCALAR, TIEARRAY, or TIEHASH function.  This
object normally has only one reference, namely, the implicit reference
from the tied variable.  When untie() is called, that reference is
destroyed.  Then, as in the first example above, the object's
destructor (DESTROY) is called, which is normal for objects that have
no more valid references; and thus the file is closed.

In the second example, however, we have stored another reference to
the tied object in <TT>$x</TT>.  That means that when untie() gets called
there will still be a valid reference to the object in existence, so
the destructor is not called at that time, and thus the file is not
closed.  The reason there is no output is because the file buffers
have not been flushed to disk.

Now that you know what the problem is, what can you do to avoid it?
Prior to the introduction of the optional UNTIE method the only way
was the good old <TT>"-w"</TT> flag. Which will spot any instances where you call
untie() and there are still valid references to the tied object.  If
the second script above this near the top <TT>"use warnings 'untie'"</TT>
or was run with the <TT>"-w"</TT> flag, Perl prints this
warning message:

    untie attempted while 1 inner references still exist

To get the script to work properly and silence the warning make sure
there are no valid references to the tied object before untie() is
called:

    undef $x;
    untie $fred;

Now that UNTIE exists the class designer can decide which parts of the
class functionality are really associated with <TT>"untie"</TT> and which with
the object being destroyed. What makes sense for a given class depends
on whether the inner references are being kept so that non-tie-related
methods can be called on the object. But in most cases it probably makes
sense to move the functionality that would have been in DESTROY to the UNTIE
method.

If the UNTIE method exists then the warning above does not occur. Instead the
UNTIE method is passed the count of ``extra'' references and can issue its own
warning if appropriate. e.g. to replicate the no UNTIE case this method can
be used:

    sub UNTIE
    {
     my ($obj,$count) = @_;
     carp "untie attempted while $count inner references still exist" if $count;
    }

SEE ALSO

See DB_File or Config for some interesting tie() implementations.
A good starting point for many tie() implementations is with one of the
modules Tie::Scalar, Tie::Array, Tie::Hash, or Tie::Handle.

BUGS

The bucket usage information provided by <TT>"scalar(%hash)"</TT> is not
available.  What this means is that using <TT>%tied_hash</TT> in boolean
context doesn't work right (currently this always tests false,
regardless of whether the hash is empty or hash elements).

Localizing tied arrays or hashes does not work.  After exiting the
scope the arrays or the hashes are not restored.

Counting the number of entries in a hash via <TT>"scalar(keys(%hash))"</TT>
or <TT>"scalar(values(%hash)"</TT>) is inefficient since it needs to iterate
through all the entries with FIRSTKEY/NEXTKEY.

Tied hash/array slices cause multiple FETCH/STORE pairs, there are no
tie methods for slice operations.

You cannot easily tie a multilevel data structure (such as a hash of
hashes) to a dbm file.  The first problem is that all but GDBM and
Berkeley DB have size limitations, but beyond that, you also have problems
with how references are to be represented on disk.  One
module that does attempt to address this need is DBM::Deep.  Check your
nearest CPAN site as described in perlmodlib for source code.  Note
that despite its name, DBM::Deep does not use dbm.  Another earlier attempt
at solving the problem is MLDBM, which is also available on the CPAN, but
which has some fairly serious limitations.

Tied filehandles are still incomplete.  sysopen(), truncate(),
flock(), fcntl(), stat() and -X can't currently be trapped.

AUTHOR

Tom Christiansen

TIEHANDLE by Sven Verdoolaege <skimo@dns.ufsia.ac.be> and Doug MacEachern <dougm@osf.org>

UNTIE by Nick Ing-Simmons <nick@ing-simmons.net>

SCALAR by Tassilo von Parseval <tassilo.von.parseval@rwth-aachen.de>

Tying Arrays by Casey West <casey@geeknest.com>

Index

NAME

SYNOPSIS

DESCRIPTION

Tying Scalars

Tying Arrays

Tying Hashes

Tying FileHandles

UNTIE this

The untie Gotcha

SEE ALSO

BUGS

AUTHOR

This document was created by
man2html,
using the manual pages.

Time: 05:29:08 GMT, December 24, 2015


text:
class FindBarController;

// Handles all platform specific operations on behalf of the FindBarController.
class FindBarPlatformHelper {
 public:
  static std::unique_ptr<FindBarPlatformHelper> Create(
      FindBarController* find_bar_controller);

  virtual ~FindBarPlatformHelper();

  // Called when the user changes the find text to |text|.
  virtual void OnUserChangedFindText(base::string16 text) = 0;

 protected:
  explicit FindBarPlatformHelper(FindBarController* find_bar_controller);

  // Owns FindBarPlatformHelper.
  FindBarController* const find_bar_controller_;

 private:
  DISALLOW_COPY_AND_ASSIGN(FindBarPlatformHelper);
};

#endif  // CHROME_BROWSER_UI_FIND_BAR_FIND_BAR_PLATFORM_HELPER_H_


text:
{{'GROUP.GROUP' | translate}}

      <hbr-filter [withDivider]="true" class="filter-pos" filterPlaceholder='group name' (filterEvt)="doFilter($event)" [currentValue]="currentTerm"></hbr-filter>

        <clr-icon shape="refresh" [hidden]="loading" ng-disabled="loading" (click)="refresh()"></clr-icon>

      <clr-datagrid [(clrDgSelected)]="selectedGroups" [clrDgLoading]="loading">
        <clr-dg-action-bar >
            <button type="button" class="btn  btn-secondary" (click)="addGroup()" [disabled]="!canAddGroup">
              <clr-icon shape="plus" size="15"></clr-icon> {{'GROUP.ADD' | translate}}</button>
              <button type="button" class="btn  btn-secondary" (click)="editGroup()" [disabled]="!canEditGroup">
                  <clr-icon shape="pencil" size="15"></clr-icon> {{'GROUP.EDIT' | translate}}</button>
                  <button type="button" class="btn  btn-secondary" (click)="openDeleteConfirmationDialog()" [disabled]="!canDeleteGroup">
                      <clr-icon shape="times" size="15"></clr-icon> {{'GROUP.DELETE' | translate}}</button>
        </clr-dg-action-bar>

        <clr-dg-column>{{'GROUP.NAME' | translate}}</clr-dg-column>
        <clr-dg-column>{{'GROUP.TYPE' | translate}}</clr-dg-column>
        <clr-dg-column *ngIf="isLdapMode">{{'GROUP.DN' | translate}}</clr-dg-column>

        <clr-dg-row *clrDgItems="let group of groups" [clrDgItem]="group">
          <clr-dg-cell>{{group.group_name}}</clr-dg-cell>
          <clr-dg-cell>{{groupToSring(group.group_type) | translate}}</clr-dg-cell>
          <clr-dg-cell *ngIf="isLdapMode">{{group.ldap_group_dn}}</clr-dg-cell>
        </clr-dg-row>
        <clr-dg-footer>
          <clr-dg-pagination #pagination [clrDgPageSize]="15">

              {{pagination.firstItem + 1}} - {{pagination.lastItem + 1}} {{'GROUP.OF' | translate}}

              {{groups?.length}} {{'GROUP.ITEMS' | translate}}
          </clr-dg-pagination>
        </clr-dg-footer>
      </clr-datagrid>

    <hbr-add-group-modal (dataChange)="loadData()"></hbr-add-group-modal>


text:
package com.kleine.genetic.algorithm;

import java.util.List;
import java.util.Random;

/**
 * Helps with random stuff, literally.
 */
public class RandomHelper {

    /**
     * Returns a random element from a list. It's tea time!
     *
     * @param listOfTea the list
     * @param <T> the type of elements of the list
     * @return the random element
     */
    public static <T> T getRandomTeaFromList(final List<T> listOfTea) {
        int randomListIndex = getRandomListIndex(listOfTea);
        return listOfTea.get(randomListIndex);
    }

    /**
     * Get the random index from a list.
     *
     * @param listOfTea the list
     * @param <T> the type of elements of the list
     * @return the random index
     */
    public static <T> int getRandomListIndex(List<T> listOfTea) {
        if (listOfTea == null) {
            throw new IllegalArgumentException("listOfTea cannot be null!");
        }
        Random random = new Random();
        double randomDouble = random.nextDouble();
        return (int) (listOfTea.size() * randomDouble);
    }
}


text:
package vm

import (
	// HACK: compile order
	// `vm`, `vm_indent`, `vm_color`, `vm_color_indent` packages uses a lot of memory to compile,
	// so forcibly make dependencies and avoid compiling in concurrent.
	// dependency order: vm => vm_indent => vm_color => vm_color_indent
	_ "github.com/goccy/go-json/internal/encoder/vm_indent"
)


text:
A TagSpaces extension able to display common images formats from the current folder.

## Features

* Displaying only the PNG, JPG, BMP, GIF files from the current folder
* Build in key shortcuts for easy navigation thought the images
* Fullscreen mode
* Image zooming

[![Screenshot of the ImageSwiper extension](https://github.com/tagspaces/documentation/raw/master/media/extensions/perspective-image-swiper-lead.png)](https://github.com/tagspaces/documentation/raw/master/media/extensions/perspective-image-swiper-demo.mp4)

## Used libraries
This extension thankfully relays on the following great libraries:

* [photoswipe](http://photoswipe.com/)

## Installation

This extensions is packaged with any new version of TagSpaces

## Source code

The source code of this extension is freely available on [github.com/tagspaces/perspectiveImageSwiper](https://github.com/tagspaces/perspectiveImageSwiper/)

## Development

If you want to extend this extensions, please follow our general [extension development guide](https://www.tagspaces.org/documentation/extension-development-guide)

## License

[MIT](https://github.com/tagspaces/perspectiveImageSwiper/blob/master/LICENSE.txt)


text:
// Copyright 2019 The Oppia Authors. All Rights Reserved.
//
// 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.

/**
 * @fileoverview General config file for Webpack.
 */

const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const path = require('path');
const webpack = require('webpack');
const macros = require('./webpack.common.macros.ts');

var htmlMinifyConfig = {
  ignoreCustomFragments: [/<\[[\s\S]*?\]>/],
  removeAttributeQuotes: false,
  caseSensitive: true,
  customAttrSurround: [[/#/, /(?:)/], [/\*/, /(?:)/], [/\[?\(?/, /(?:)/]],
  customAttrAssign: [/\)?\]?=/]
};
var commonPrefix = './core/templates';
var defaultMeta = {
  name: 'Personalized Online Learning from Oppia',
  description: 'Oppia is a free, open-source learning platform. Join ' +
    'the community to create or try an exploration today!'
};

module.exports = {
  resolve: {
    modules: [
      path.resolve(__dirname, 'assets'),
      path.resolve(__dirname, 'core/templates'),
      path.resolve(__dirname, 'extensions'),
      path.resolve(__dirname, 'node_modules'),
      path.resolve(__dirname, 'third_party')
    ],
    extensions: ['.ts', '.js', '.json', '.html', '.svg', '.png'],
    alias: {
      '@angular/upgrade/static': (
        '@angular/upgrade/bundles/upgrade-static.umd.js'),
      // This is needed because in app.constants.ts we need to import
      // assets/constants.ts. We can't directly write import 'constants'
      // because a module named 'constants' is defined in '@types/node'
      // package.
      'assets/constants': 'constants.ts'
    }
  },
  entry: {
    about: commonPrefix + '/pages/about-page/about-page.import.ts',
    admin: commonPrefix + '/pages/admin-page/admin-page.import.ts',
    classroom:
      commonPrefix + '/pages/classroom-page/classroom-page.import.ts',
    collection_editor:
      commonPrefix + '/pages/collection-editor-page/' +
      'collection-editor-page.import.ts',
    collection_player:
      commonPrefix + '/pages/collection-player-page/' +
      'collection-player-page.import.ts',
    contact: commonPrefix + '/pages/contact-page/contact-page.import.ts',
    console_errors: commonPrefix + '/tests/console_errors.import.ts',
    creator_dashboard:
      commonPrefix + '/pages/creator-dashboard-page/' +
      'creator-dashboard-page.import.ts',
    contributor_dashboard:
      commonPrefix + '/pages/contributor-dashboard-page/' +
      'contributor-dashboard-page.import.ts',
    delete_account:
      commonPrefix + '/pages/delete-account-page/' +
        'delete-account-page.import.ts',
    donate: commonPrefix + '/pages/donate-page/donate-page.import.ts',
    email_dashboard:
      commonPrefix +
      '/pages/email-dashboard-pages/email-dashboard-page.import.ts',
    email_dashboard_result:
      commonPrefix +
      '/pages/email-dashboard-pages/email-dashboard-result.import.ts',
    error: commonPrefix + '/pages/error-pages/error-page.import.ts',
    exploration_editor:
      commonPrefix + '/pages/exploration-editor-page/' +
      'exploration-editor-page.import.ts',
    exploration_player:
      commonPrefix + '/pages/exploration-player-page/' +
      'exploration-player-page.import.ts',
    get_started:
      commonPrefix + '/pages/get-started-page/get-started-page.import.ts',
    landing:
      commonPrefix + '/pages/landing-pages/topic-landing-page/' +
      'topic-landing-page.import.ts',
    learner_dashboard:
      commonPrefix + '/pages/learner-dashboard-page/' +
      'learner-dashboard-page.import.ts',
    library: commonPrefix + '/pages/library-page/library-page.import.ts',
    maintenance:
      commonPrefix + '/pages/maintenance-page/maintenance-page.import.ts',
    moderator:
      commonPrefix + '/pages/moderator-page/moderator-page.import.ts',
    notifications_dashboard:
      commonPrefix + '/pages/notifications-dashboard-page/' +
      'notifications-dashboard-page.import.ts',
    pending_account_deletion:
      commonPrefix + '/pages/pending-account-deletion-page/' +
      'pending-account-deletion-page.import.ts',
    practice_session:
      commonPrefix + '/pages/practice-session-page/' +
        'practice-session-page.import.ts',
    privacy: commonPrefix + '/pages/privacy-page/privacy-page.import.ts',
    preferences:
      commonPrefix + '/pages/preferences-page/preferences-page.import.ts',
    profile: commonPrefix + '/pages/profile-page/profile-page.import.ts',
    review_test:
      commonPrefix + '/pages/review-test-page/review-test-page.import.ts',
    signup: commonPrefix + '/pages/signup-page/signup-page.import.ts',
    skill_editor:
      commonPrefix + '/pages/skill-editor-page/skill-editor-page.import.ts',
    splash: commonPrefix + '/pages/splash-page/splash-page.import.ts',
    stewards:
      commonPrefix + '/pages/landing-pages/stewards-landing-page/' +
      'stewards-landing-page.import.ts',
    story_editor:
      commonPrefix + '/pages/story-editor-page/story-editor-page.import.ts',
    story_viewer:
      commonPrefix + '/pages/story-viewer-page/story-viewer-page.import.ts',
    subtopic_viewer:
      commonPrefix +
      '/pages/subtopic-viewer-page/subtopic-viewer-page.import.ts',
    teach: commonPrefix + '/pages/teach-page/teach-page.import.ts',
    terms: commonPrefix + '/pages/terms-page/terms-page.import.ts',
    thanks: commonPrefix + '/pages/thanks-page/thanks-page.import.ts',
    topic_editor:
      commonPrefix + '/pages/topic-editor-page/topic-editor-page.import.ts',
    topics_and_skills_dashboard: (
      commonPrefix +
      '/pages/topics-and-skills-dashboard-page/' +
      'topics-and-skills-dashboard-page.import.ts'
    ),
    topic_viewer:
      commonPrefix + '/pages/topic-viewer-page/topic-viewer-page.import.ts',
  },
  plugins: [
    new HtmlWebpackPlugin({
      chunks: ['about'],
      filename: 'about-page.mainpage.html',
      meta: {
        name: defaultMeta.name,
        description: 'With Oppia, you can access free lessons on ' +
          'math, physics, statistics, chemistry, music, history and ' +
          'more from anywhere in the world. Oppia is a nonprofit ' +
          'with the mission of providing high-quality ' +
          'education to those who lack access to it.'
      },
      template: commonPrefix + '/pages/about-page/about-page.mainpage.html',
      minify: htmlMinifyConfig,
      inject: false
    }),
    new HtmlWebpackPlugin({
      chunks: ['admin'],
      filename: 'admin-page.mainpage.html',
      meta: {
        name: defaultMeta.name,
        description: 'With Oppia, you can access free lessons on ' +
          'math, physics, statistics, chemistry, music, history and ' +
          'more from anywhere in the world. Oppia is a nonprofit ' +
          'with the mission of providing high-quality ' +
          'education to those who lack access to it.'
      },
      template: commonPrefix + '/pages/admin-page/admin-page.mainpage.html',
      minify: htmlMinifyConfig,
      inject: false
    }),
    new HtmlWebpackPlugin({
      chunks: ['classroom'],
      filename: 'classroom-page.mainpage.html',
      meta: {
        name: defaultMeta.name,
        description: 'Learn and practice all major math topics, functions, ' +
        'equations, and formulas through problems, stories, and examples.'
      },
      template:
        commonPrefix + '/pages/classroom-page/' +
        'classroom-page.mainpage.html',
      minify: htmlMinifyConfig,
      inject: false
    }),
    new HtmlWebpackPlugin({
      chunks: ['collection_editor'],
      filename: 'collection-editor-page.mainpage.html',
      meta: {
        name: defaultMeta.name,
        description: 'Contact the Oppia team, submit feedback, and learn ' +
          'how to get involved with the Oppia project.'
      },
      template:
        commonPrefix + '/pages/collection-editor-page/' +
        'collection-editor-page.mainpage.html',
      minify: htmlMinifyConfig,
      inject: false
    }),
    new HtmlWebpackPlugin({
      chunks: ['collection_player'],
      filename: 'collection-player-page.mainpage.html',
      meta: {
        name: defaultMeta.name,
        description: 'Contact the Oppia team, submit feedback, and learn ' +
          'how to get involved with the Oppia project.'
      },
      template:
        commonPrefix + '/pages/collection-player-page/' +
        'collection-player-page.mainpage.html',
      minify: htmlMinifyConfig,
      inject: false
    }),
    new HtmlWebpackPlugin({
      chunks: ['console_errors'],
      filename: 'console_errors.html',
      meta: {
        name: defaultMeta.name,
        description: 'Contact the Oppia team, submit feedback, and learn ' +
          'how to get involved with the Oppia project.'
      },
      template: commonPrefix + '/tests/console_errors.html',
      minify: htmlMinifyConfig,
      inject: false
    }),
    new HtmlWebpackPlugin({
      chunks: ['contact'],
      filename: 'contact-page.mainpage.html',
      meta: {
        name: defaultMeta.name,
        description: 'Contact the Oppia team, submit feedback, and learn ' +
          'how to get involved with the Oppia project.'
      },
      template: commonPrefix + '/pages/contact-page/contact-page.mainpage.html',
      minify: htmlMinifyConfig,
      inject: false
    }),
    new HtmlWebpackPlugin({
      chunks: ['creator_dashboard'],
      filename: 'creator-dashboard-page.mainpage.html',
      meta: defaultMeta,
      template:
        commonPrefix + '/pages/creator-dashboard-page/' +
        'creator-dashboard-page.mainpage.html',
      minify: htmlMinifyConfig,
      inject: false
    }),
    new HtmlWebpackPlugin({
      chunks: ['contributor_dashboard'],
      filename: 'contributor-dashboard-page.mainpage.html',
      meta: defaultMeta,
      template:
        commonPrefix + '/pages/contributor-dashboard-page/' +
        'contributor-dashboard-page.mainpage.html',
      minify: htmlMinifyConfig,
      inject: false
    }),
    new HtmlWebpackPlugin({
      chunks: ['delete_account'],
      filename: 'delete-account-page.mainpage.html',
      meta: defaultMeta,
      template:
        commonPrefix + '/pages/delete-account-page/' +
          'delete-account-page.mainpage.html',
      minify: htmlMinifyConfig,
      inject: false
    }),
    new HtmlWebpackPlugin({
      chunks: ['donate'],
      filename: 'donate-page.mainpage.html',
      meta: {
        name: defaultMeta.name,
        description: 'Donate to The Oppia Foundation to enable more ' +
        'students to receive the quality education they deserve.'
      },
      template: commonPrefix + '/pages/donate-page/donate-page.mainpage.html',
      minify: htmlMinifyConfig,
      inject: false
    }),
    new HtmlWebpackPlugin({
      chunks: ['email_dashboard'],
      filename: 'email-dashboard-page.mainpage.html',
      meta: defaultMeta,
      template: (
        commonPrefix +
        '/pages/email-dashboard-pages/email-dashboard-page.mainpage.html'),
      minify: htmlMinifyConfig,
      inject: false
    }),
    new HtmlWebpackPlugin({
      chunks: ['email_dashboard_result'],
      filename: 'email-dashboard-result.mainpage.html',
      meta: defaultMeta,
      template:
        commonPrefix +
        '/pages/email-dashboard-pages/email-dashboard-result.mainpage.html',
      minify: htmlMinifyConfig,
      inject: false
    }),
    new HtmlWebpackPlugin({
      chunks: ['error'],
      filename: 'error-iframed.mainpage.html',
      meta: defaultMeta,
      template: commonPrefix + '/pages/error-pages/error-iframed.mainpage.html',
      minify: htmlMinifyConfig,
      inject: false
    }),
    new HtmlWebpackPlugin({
      chunks: ['error'],
      filename: 'error-page-400.mainpage.html',
      meta: defaultMeta,
      template: commonPrefix + '/pages/error-pages/error-page.mainpage.html',
      minify: htmlMinifyConfig,
      inject: false,
      statusCode: 400
    }),
    new HtmlWebpackPlugin({
      chunks: ['error'],
      filename: 'error-page-401.mainpage.html',
      meta: defaultMeta,
      template: commonPrefix + '/pages/error-pages/error-page.mainpage.html',
      minify: htmlMinifyConfig,
      inject: false,
      statusCode: 401
    }),
    new HtmlWebpackPlugin({
      chunks: ['error'],
      filename: 'error-page-404.mainpage.html',
      meta: defaultMeta,
      template: commonPrefix + '/pages/error-pages/error-page.mainpage.html',
      minify: htmlMinifyConfig,
      inject: false,
      statusCode: 404
    }),
    new HtmlWebpackPlugin({
      chunks: ['error'],
      filename: 'error-page-500.mainpage.html',
      meta: defaultMeta,
      template: commonPrefix + '/pages/error-pages/error-page.mainpage.html',
      minify: htmlMinifyConfig,
      inject: false,
      statusCode: 500
    }),
    new HtmlWebpackPlugin({
      chunks: ['error'],
      filename: 'error-iframed.mainpage.html',
      meta: defaultMeta,
      template: commonPrefix + '/pages/error-pages/error-iframed.mainpage.html',
      minify: htmlMinifyConfig,
      inject: false
    }),
    new HtmlWebpackPlugin({
      chunks: ['exploration_editor'],
      filename: 'exploration-editor-page.mainpage.html',
      meta: {
        name: defaultMeta.name,
        description: 'Help others learn new things. Create lessons through ' +
          'explorations and share your knowledge with the community.'
      },
      template:
        commonPrefix + '/pages/exploration-editor-page/' +
        'exploration-editor-page.mainpage.html',
      minify: htmlMinifyConfig,
      inject: false
    }),
    new HtmlWebpackPlugin({
      chunks: ['exploration_player'],
      filename: 'exploration-player-page.mainpage.html',
      meta: defaultMeta,
      template:
        commonPrefix + '/pages/exploration-player-page/' +
        'exploration-player-page.mainpage.html',
      minify: htmlMinifyConfig,
      inject: false
    }),
    new HtmlWebpackPlugin({
      chunks: ['get_started'],
      filename: 'get-started-page.mainpage.html',
      meta: {
        name: defaultMeta.name,
        description: 'Learn how to get started using Oppia.'
      },
      template:
        commonPrefix + '/pages/get-started-page/get-started-page.mainpage.html',
      minify: htmlMinifyConfig,
      inject: false
    }),
    new HtmlWebpackPlugin({
      chunks: ['landing'],
      filename: 'topic-landing-page.mainpage.html',
      meta: defaultMeta,
      template:
        commonPrefix + '/pages/landing-pages/topic-landing-page/' +
        'topic-landing-page.mainpage.html',
      minify: htmlMinifyConfig,
      inject: false
    }),
    new HtmlWebpackPlugin({
      chunks: ['learner_dashboard'],
      filename: 'learner-dashboard-page.mainpage.html',
      meta: defaultMeta,
      template:
        commonPrefix + '/pages/learner-dashboard-page/' +
        'learner-dashboard-page.mainpage.html',
      minify: htmlMinifyConfig,
      inject: false
    }),
    new HtmlWebpackPlugin({
      chunks: ['library'],
      filename: 'library-page.mainpage.html',
      meta: {
        name: defaultMeta.name,
        description: 'Looking to learn something new? Learn any subject ' +
          'of your choice created by professors, teachers and Oppia ' +
          'users! Free lessons are always available for any topic and ' +
          'level you want.'
      },
      template: commonPrefix + '/pages/library-page/library-page.mainpage.html',
      minify: htmlMinifyConfig,
      inject: false
    }),
    new HtmlWebpackPlugin({
      chunks: ['maintenance'],
      filename: 'maintenance-page.mainpage.html',
      meta: defaultMeta,
      template:
        commonPrefix + '/pages/maintenance-page/maintenance-page.mainpage.html',
      minify: htmlMinifyConfig,
      inject: false
    }),
    new HtmlWebpackPlugin({
      chunks: ['moderator'],
      filename: 'moderator-page.mainpage.html',
      meta: defaultMeta,
      template:
        commonPrefix + '/pages/moderator-page/moderator-page.mainpage.html',
      minify: htmlMinifyConfig,
      inject: false
    }),
    new HtmlWebpackPlugin({
      chunks: ['notifications_dashboard'],
      filename: 'notifications-dashboard-page.mainpage.html',
      meta: {
        name: defaultMeta.name,
        description: 'Keep track of the lessons you have created, as well ' +
          'as feedback from learners.'
      },
      template: (
        commonPrefix +
        '/pages/notifications-dashboard-page/' +
        'notifications-dashboard-page.mainpage.html'
      ),
      minify: htmlMinifyConfig,
      inject: false
    }),
    new HtmlWebpackPlugin({
      chunks: ['pending_account_deletion'],
      filename: 'pending-account-deletion-page.mainpage.html',
      meta: defaultMeta,
      template:
          commonPrefix + '/pages/pending-account-deletion-page/' +
          'pending-account-deletion-page.mainpage.html',
      minify: htmlMinifyConfig,
      inject: false
    }),
    new HtmlWebpackPlugin({
      chunks: ['practice_session'],
      filename: 'practice-session-page.mainpage.html',
      meta: defaultMeta,
      template:
        commonPrefix + '/pages/practice-session-page/' +
        'practice-session-page.mainpage.html',
      minify: htmlMinifyConfig,
      inject: false
    }),
    new HtmlWebpackPlugin({
      chunks: ['preferences'],
      filename: 'preferences-page.mainpage.html',
      meta: {
        name: defaultMeta.name,
        description: 'Change your Oppia profile settings and preferences'
      },
      template:
        commonPrefix + '/pages/preferences-page/preferences-page.mainpage.html',
      minify: htmlMinifyConfig,
      inject: false
    }),
    new HtmlWebpackPlugin({
      chunks: ['privacy'],
      filename: 'privacy-page.mainpage.html',
      meta: defaultMeta,
      template: commonPrefix + '/pages/privacy-page/privacy-page.mainpage.html',
      minify: htmlMinifyConfig,
      inject: false
    }),
    new HtmlWebpackPlugin({
      chunks: ['profile'],
      filename: 'profile-page.mainpage.html',
      meta: defaultMeta,
      template: commonPrefix + '/pages/profile-page/profile-page.mainpage.html',
      minify: htmlMinifyConfig,
      inject: false
    }),
    new HtmlWebpackPlugin({
      chunks: ['review_test'],
      filename: 'review-test-page.mainpage.html',
      meta: defaultMeta,
      template:
        commonPrefix + '/pages/review-test-page/review-test-page.mainpage.html',
      minify: htmlMinifyConfig,
      inject: false
    }),
    new HtmlWebpackPlugin({
      chunks: ['signup'],
      filename: 'signup-page.mainpage.html',
      meta: {
        name: defaultMeta.name,
        description: 'Sign up for Oppia and begin exploring a new subject.'
      },
      template: commonPrefix + '/pages/signup-page/signup-page.mainpage.html',
      minify: htmlMinifyConfig,
      inject: false
    }),
    new HtmlWebpackPlugin({
      chunks: ['skill_editor'],
      filename: 'skill-editor-page.mainpage.html',
      meta: defaultMeta,
      template:
        commonPrefix + '/pages/skill-editor-page/' +
        'skill-editor-page.mainpage.html',
      minify: htmlMinifyConfig,
      inject: false
    }),
    new HtmlWebpackPlugin({
      chunks: ['splash'],
      filename: 'splash-page.mainpage.html',
      meta: {
        name: defaultMeta.name,
        description: 'With Oppia, you can access free lessons on math, ' +
        'physics, statistics, chemistry, music, history and more from ' +
        'anywhere in the world. Oppia is a nonprofit with the mission ' +
        'of providing high-quality education to those who lack access to it.'
      },
      template: commonPrefix + '/pages/splash-page/splash-page.mainpage.html',
      minify: htmlMinifyConfig,
      inject: false
    }),
    new HtmlWebpackPlugin({
      chunks: ['stewards'],
      filename: 'stewards-landing-page.mainpage.html',
      meta: defaultMeta,
      template:
        commonPrefix +
        '/pages/landing-pages/stewards-landing-page/' +
        'stewards-landing-page.mainpage.html',
      minify: htmlMinifyConfig,
      inject: false
    }),
    new HtmlWebpackPlugin({
      chunks: ['story_editor'],
      filename: 'story-editor-page.mainpage.html',
      meta: defaultMeta,
      template:
        commonPrefix + '/pages/story-editor-page/' +
        'story-editor-page.mainpage.html',
      minify: htmlMinifyConfig,
      inject: false
    }),
    new HtmlWebpackPlugin({
      chunks: ['story_viewer'],
      filename: 'story-viewer-page.mainpage.html',
      meta: defaultMeta,
      template:
        commonPrefix + '/pages/story-viewer-page/' +
        'story-viewer-page.mainpage.html',
      minify: htmlMinifyConfig,
      inject: false
    }),
    new HtmlWebpackPlugin({
      chunks: ['subtopic_viewer'],
      filename: 'subtopic-viewer-page.mainpage.html',
      meta: defaultMeta,
      template:
        commonPrefix + '/pages/subtopic-viewer-page/' +
        'subtopic-viewer-page.mainpage.html',
      minify: htmlMinifyConfig,
      inject: false
    }),
    new HtmlWebpackPlugin({
      chunks: ['teach'],
      filename: 'teach-page.mainpage.html',
      meta: {
        name: defaultMeta.name,
        description: 'The Oppia library is full of user-created lessons ' +
        'called \'explorations\'. Read about how to participate in the ' +
        'community and begin creating explorations.'
      },
      template: commonPrefix + '/pages/teach-page/teach-page.mainpage.html',
      minify: htmlMinifyConfig,
      inject: false
    }),
    new HtmlWebpackPlugin({
      chunks: ['terms'],
      filename: 'terms-page.mainpage.html',
      meta: {
        name: defaultMeta.name,
        description: 'Oppia is a 501(c)(3) registered non-profit open-source' +
        ' e-learning platform. Learn about our terms and conditions for ' +
        'creating and distributing learning material.'
      },
      template: commonPrefix + '/pages/terms-page/terms-page.mainpage.html',
      minify: htmlMinifyConfig,
      inject: false
    }),
    new HtmlWebpackPlugin({
      chunks: ['thanks'],
      filename: 'thanks-page.mainpage.html',
      meta: {
        name: defaultMeta.name,
        description: 'Thank you for donating to The Oppia Foundation!'
      },
      template: commonPrefix + '/pages/thanks-page/thanks-page.mainpage.html',
      minify: htmlMinifyConfig,
      inject: false
    }),
    new HtmlWebpackPlugin({
      chunks: ['topic_editor'],
      filename: 'topic-editor-page.mainpage.html',
      meta: defaultMeta,
      template:
        commonPrefix + '/pages/topic-editor-page/' +
        'topic-editor-page.mainpage.html',
      minify: htmlMinifyConfig,
      inject: false
    }),
    new HtmlWebpackPlugin({
      chunks: ['topics_and_skills_dashboard'],
      filename: 'topics-and-skills-dashboard-page.mainpage.html',
      meta: defaultMeta,
      template: (
        commonPrefix +
        '/pages/topics-and-skills-dashboard-page/' +
        'topics-and-skills-dashboard-page.mainpage.html'
      ),
      minify: htmlMinifyConfig,
      inject: false
    }),
    new HtmlWebpackPlugin({
      chunks: ['topic_viewer'],
      filename: 'topic-viewer-page.mainpage.html',
      meta: defaultMeta,
      template:
        commonPrefix + '/pages/topic-viewer-page/' +
        'topic-viewer-page.mainpage.html',
      minify: htmlMinifyConfig,
      inject: false
    }),
    new CleanWebpackPlugin({
      cleanAfterEveryBuildPatterns: ['**/*', '!*.html'],
    }),
    new webpack.LoaderOptionsPlugin({
      options: {
        macros: {
          load: macros.load,
          loadExtensions: macros.loadExtensions
        },
      },
    }),
  ],
  module: {
    rules: [{
      test: /\.ts$/,
      include: [
        path.resolve(__dirname, 'assets'),
        path.resolve(__dirname, 'core/templates'),
        path.resolve(__dirname, 'extensions'),
        path.resolve(__dirname, 'typings')
      ],
      use: [
        'cache-loader',
        {
          loader: 'ts-loader',
          options: {
            // Typescript checks do the type checking.
            transpileOnly: true
          }
        },
        {
          loader: 'angular2-template-loader'
        }
      ]
    },
    {
      test: {
        include: /.html$/,
        exclude: /(directive|component)\.html$/
      },
      loader: ['cache-loader', 'underscore-template-loader']
    },
    {
      test: /(directive|component)\.html$/,
      use: [
        'cache-loader',
        {
          loader: 'html-loader',
          options: {
            attributes: false,
            minimize: htmlMinifyConfig,
          }
        }
      ]
    },
    {
      test: /\.css$/,
      include: [
        path.resolve(__dirname, 'extensions'),
        path.resolve(__dirname, 'node_modules'),
      ],
      use: [
        'cache-loader',
        'style-loader',
        {
          loader: 'css-loader',
          options: {
            url: false,
          }
        }
      ]
    }]
  },
  externals: {
    jquery: 'jQuery'
  },
  optimization: {
    runtimeChunk: 'single',
    splitChunks: {
      chunks: 'all'
    },
  }
};


text:
var timeout	= 250;
var closetimer	= 0;
var ddmenuitem	= 0;

// open hidden layer
function mopen(id)
{
  // cancel close timer
  mcancelclosetime();

  // close old layer
  if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';

  // get new layer and show it
  ddmenuitem = document.getElementById(id);
  ddmenuitem.style.visibility = 'visible';

}
// close showed layer
function mclose()
{
  if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';
}

// go close timer
function mclosetime()
{
  closetimer = window.setTimeout(mclose, timeout);
}

// cancel close timer
function mcancelclosetime()
{
  if(closetimer)
    {
      window.clearTimeout(closetimer);
      closetimer = null;
    }
}

// close layer when click-out
document.onclick = mclose;


text:
package org.csveed.api;

import java.io.Reader;
import java.io.Writer;
import java.util.Collection;
import java.util.List;
import java.util.Locale;

import org.csveed.bean.AbstractMapper;
import org.csveed.bean.BeanInstructions;
import org.csveed.bean.BeanParser;
import org.csveed.bean.BeanReader;
import org.csveed.bean.BeanReaderImpl;
import org.csveed.bean.BeanWriter;
import org.csveed.bean.BeanWriterImpl;
import org.csveed.bean.conversion.Converter;
import org.csveed.report.CsvException;
import org.csveed.report.GeneralError;
import org.csveed.row.RowInstructions;
import org.csveed.row.RowReader;
import org.csveed.row.RowReaderImpl;
import org.csveed.row.RowWriter;
import org.csveed.row.RowWriterImpl;

public class CsvClientImpl<T> implements CsvClient<T> {

    private BeanReader<T> beanReader;

    private BeanWriter<T> beanWriter;

    private RowReader rowReader;

    private RowWriter rowWriter;

    private final RowInstructions rowInstructions;

    private BeanInstructions beanInstructions;

    public CsvClientImpl(Writer writer) {
        this.rowWriter = new RowWriterImpl(writer);
        this.rowInstructions = getRowWriter().getRowInstructions();
    }

    public CsvClientImpl(Writer writer, Class<T> beanClass) {
        this(writer, new BeanParser().getBeanInstructions(beanClass));
    }

    public CsvClientImpl(Writer writer, BeanInstructions beanInstructions) {
        this.beanWriter= new BeanWriterImpl<>(writer, beanInstructions);
        this.rowWriter = getBeanWriter().getRowWriter();
        this.rowInstructions = getRowWriter().getRowInstructions();
        this.beanInstructions = beanInstructions;
    }

    public CsvClientImpl(Reader reader) {
        this.rowReader = new RowReaderImpl(reader);
        this.rowInstructions = getRowReader().getRowInstructions();
    }

    public CsvClientImpl(Reader reader, Class<T> beanClass) {
        this(reader, new BeanParser().getBeanInstructions(beanClass));
    }

    public CsvClientImpl(Reader reader, BeanInstructions beanInstructions) {
        this.beanReader = new BeanReaderImpl<>(reader, beanInstructions);
        this.rowReader = getBeanReader().getRowReader();
        this.rowInstructions = getRowReader().getRowInstructions();
        this.beanInstructions = beanInstructions;
    }

    @Override
    public void writeBeans(Collection<T> beans) {
        getBeanWriter().writeBeans(beans);
    }

    @Override
    public void writeBean(T bean) {
        getBeanWriter().writeBean(bean);
    }

    @Override
    public void writeRow(Row row) {
        getRowWriter().writeRow(row);
    }

    @Override
    public Row writeRow(String[] row) {
        return getRowWriter().writeRow(row);
    }

    @Override
    public void writeRows(Collection<Row> rows) {
        getRowWriter().writeRows(rows);
    }

    @Override
    public void writeRows(String[][] rows) {
        getRowWriter().writeRows(rows);
    }

    @Override
    public Header writeHeader(String[] header) {
        return getRowWriter().writeHeader(header);
    }

    @Override
    public void writeHeader(Header header) {
        getRowWriter().writeHeader(header);
    }

    @Override
    public void writeHeader() {
        getBeanWriter().writeHeader();
    }

    @Override
    public List<T> readBeans() {
        return getBeanReader().readBeans();
    }

    @Override
    public T readBean() {
        return getBeanReader().readBean();
    }

    @Override
    public List<Row> readRows() {
        return getRowReader().readRows();
    }

    @Override
    public Row readRow() {
        return getRowReader().readRow();
    }

    @Override
    public Header readHeader() {
        return getRowReader().readHeader();
    }

    @Override
    public int getCurrentLine() {
        return getRowReader().getCurrentLine();
    }

    @Override
    public boolean isFinished() {
        return getRowReader().isFinished();
    }

    @Override
    public CsvClient<T> setUseHeader(boolean useHeader) {
        rowInstructions.setUseHeader(useHeader);
        return this;
    }

    @Override
    public CsvClient<T> setStartRow(int startRow) {
        rowInstructions.setStartRow(startRow);
        return this;
    }

    @Override
    public CsvClient<T> setEscape(char symbol) {
        rowInstructions.setEscape(symbol);
        return this;
    }

    @Override
    public CsvClient<T> setQuote(char symbol) {
        rowInstructions.setQuote(symbol);
        return this;
    }

    @Override
    public CsvClient<T> setSeparator(char symbol) {
        rowInstructions.setSeparator(symbol);
        return this;
    }

    @Override
    public CsvClient<T> setComment(char symbol) {
        rowInstructions.setComment(symbol);
        return this;
    }

    @Override
    public CsvClient<T> setEndOfLine(char[] symbols) {
        rowInstructions.setEndOfLine(symbols);
        return this;
    }

    @Override
    public CsvClient<T> skipEmptyLines(boolean skip) {
        rowInstructions.skipEmptyLines(skip);
        return this;
    }

    @Override
    public CsvClient<T> skipCommentLines(boolean skip) {
        rowInstructions.skipCommentLines(skip);
        return this;
    }

    @Override
    public CsvClient<T> setMapper(Class<? extends AbstractMapper> mapper) {
        getBeanInstructions().setMapper(mapper);
        return this;
    }

    @Override
    public CsvClient<T> setDate(String propertyName, String dateFormat) {
        getBeanInstructions().setDate(propertyName, dateFormat);
        return this;
    }

    @Override
    public CsvClient<T> setLocalizedNumber(String propertyName, Locale locale) {
        getBeanInstructions().setLocalizedNumber(propertyName, locale);
        return this;
    }

    @Override
    public CsvClient<T> setRequired(String propertyName, boolean required) {
        getBeanInstructions().setRequired(propertyName, required);
        return this;
    }

    @Override
    public CsvClient<T> setConverter(String propertyName, Converter converter) {
        getBeanInstructions().setConverter(propertyName, converter);
        return this;
    }

    @Override
    public CsvClient<T> ignoreProperty(String propertyName) {
        getBeanInstructions().ignoreProperty(propertyName);
        return this;
    }

    @Override
    public CsvClient<T> mapColumnIndexToProperty(int columnIndex, String propertyName) {
        getBeanInstructions().mapColumnIndexToProperty(columnIndex, propertyName);
        return this;
    }

    @Override
    public CsvClient<T> mapColumnNameToProperty(String columnName, String propertyName) {
        getBeanInstructions().mapColumnNameToProperty(columnName, propertyName);
        return this;
    }

    @Override
    public CsvClient<T> setStartIndexDynamicColumns(int startIndex) {
        getBeanInstructions().setStartIndexDynamicColumns(startIndex);
        return this;
    }

    @Override
    public CsvClient<T> setHeaderNameToProperty(String propertyName) {
        getBeanInstructions().setHeaderNameToProperty(propertyName);
        return this;
    }

    @Override
    public CsvClient<T> setHeaderValueToProperty(String propertyName) {
        getBeanInstructions().setHeaderValueToProperty(propertyName);
        return this;
    }

    private BeanInstructions getBeanInstructions() {
        if (this.beanInstructions == null) {
            throw new CsvException(new GeneralError(
                    "BeanInstructions have not been initialized. Make sure to pass BeanInstructions or the bean class" +
                    " to CsvClient."
            ));
        }
        return this.beanInstructions;
    }

    private BeanReader<T> getBeanReader() {
        if (this.beanReader == null) {
            throw new CsvException(new GeneralError(
                    "BeanReader has not been initialized. Make sure to pass BeanInstructions or the bean class to CsvClient."
            ));
        }
        return this.beanReader;
    }

    private BeanWriter<T> getBeanWriter() {
        if (this.beanWriter == null) {
            throw new CsvException(new GeneralError(
                    "BeanWriter has not been initialized. Make sure to pass BeanInstructions or the bean class to CsvClient."
            ));
        }
        return this.beanWriter;
    }

    private RowReader getRowReader() {
        if (this.rowReader == null) {
            throw new CsvException(new GeneralError(
                    "RowReader has not been initialized. Make sure to pass a Reader to the constructor."));
        }
        return this.rowReader;
    }

    public RowWriter getRowWriter() {
        if (this.rowWriter == null) {
            throw new CsvException(new GeneralError(
                    "RowWriter has not been initialized. Make sure to pass a Writer to the constructor."));
        }
        return rowWriter;
    }

}