text:
=head1 NAME

Mail::Transport::IMAP4 - proxy to Mail::IMAPClient

=head1 INHERITANCE

 Mail::Transport::IMAP4
   is a Mail::Transport::Receive
   is a Mail::Transport
   is a Mail::Reporter

=head1 SYNOPSIS

 my $imap = Mail::Transport::IMAP4->new(...);
 my $message = $imap->receive($id);
 $imap->send($message);

=head1 DESCRIPTION

The IMAP4 protocol is quite complicated: it is feature rich and allows
verious asynchronous actions.  The main document describing IMAP is
rfc3501 (which obsoleted the original specification of protocol 4r1
in rfc2060 in March 2003).

This package, as part of MailBox, does not implement the actual
protocol itself but uses Mail::IMAPClient to do the work. The task
for this package is to hide as many differences between that module's
interface and the common MailBox folder types.  Multiple
L<Mail::Box::IMAP4|Mail::Box::IMAP4> folders can share one L<Mail::Transport::IMAP4|Mail::Transport::IMAP4>
connection.

The Mail::IMAPClient module is the best IMAP4 implementation for
Perl5, but is not maintained.  There are many known problems with the
module, and solving those is outside the scope of MailBox.  See
F<http://rt.cpan.org/Public/Dist/Display.html?Name=Mail-IMAPClient>
for all the reported bugs.

=head1 METHODS

$obj-E<gt>B<url>

=over 4

Represent this imap4 connection as URL.

=back

=head2 Constructors

Mail::Transport::IMAP4-E<gt>B<new>(OPTIONS)

=over 4

Create the IMAP connection to the server.  IMAP servers can handle
multiple folders for a single user, which means that connections
may get shared.  This is sharing is hidden for the user.

When an C<imap_client> is specified, then the options C<hostname>,
C<port>, C<username>, and C<password> are extracted from it.

 Option      --Defined in     --Default
 authenticate                   'AUTO'
 domain                         <server_name>
 executable    Mail::Transport  undef
 hostname      Mail::Transport  'localhost'
 imap_client                    Mail::IMAPClient
 interval      Mail::Transport  30
 log           Mail::Reporter   'WARNINGS'
 password      Mail::Transport  undef
 port          Mail::Transport  143
 proxy         Mail::Transport  undef
 retry         Mail::Transport  <false>
 timeout       Mail::Transport  120
 trace         Mail::Reporter   'WARNINGS'
 username      Mail::Transport  undef
 via           Mail::Transport  'imap'

. authenticate => TYPE|ARRAY-OF-TYPES

=over 4

Authenthication method to L<login()|Mail::Transport::IMAP4/"Protocol [internals]">, which will be passed to
L<Mail::IMAPClient> method authenticate().  See the latter method for
the available types.

=back

. domain => WINDOWS_DOMAIN

=over 4

Used for NTLM authentication.

=back

. executable => FILENAME

. hostname => HOSTNAME|ARRAY-OF-HOSTNAMES

. imap_client => OBJECT|CLASS

=over 4

When an OBJECT is supplied, that client will be used for the implementation
of the IMAP4 protocol. Information about server and such are extracted from
the OBJECT to have the accessors to produce correct results. The OBJECT
shall be a L<Mail::IMAPClient|Mail::IMAPClient>.

When a CLASS is given, an object of that type is created for you.  The created
object can be retreived via L<imapClient()|Mail::Transport::IMAP4/"Protocol [internals]">, and than configured as
defined by L<Mail::IMAPClient|Mail::IMAPClient>.

=back

. interval => SECONDS

. log => LEVEL

. password => STRING

. port => INTEGER

. proxy => PATH

. retry => NUMBER|undef

. timeout => SECONDS

. trace => LEVEL

. username => STRING

. via => CLASS|NAME

=back

=head2 Receiving mail

$obj-E<gt>B<receive>([UNIQUE-MESSAGE-ID])

=over 4

See L<Mail::Transport::Receive/"Receiving mail">

=back

=head2 Server connection

$obj-E<gt>B<findBinary>(NAME [, DIRECTORIES])

=over 4

See L<Mail::Transport/"Server connection">

=back

$obj-E<gt>B<remoteHost>

=over 4

See L<Mail::Transport/"Server connection">

=back

$obj-E<gt>B<retry>

=over 4

See L<Mail::Transport/"Server connection">

=back

=head2 Attributes

$obj-E<gt>B<authentication>(['AUTO'|TYPE|LIST-OF-TYPES])

=over 4

Returned is a list of pairs (ref arrays) each describing one possible
way to contact the server. Each pair contains a mechanism name and
a challange callback (which may be C<undef>).

The settings are used by L<login()|Mail::Transport::IMAP4/"Protocol [internals]"> to get server access.  The initial
value origins from L<new(authenticate)|Mail::Transport::IMAP4/"METHODS">, but may be changed later.

Available basic TYPES are C<CRAM-MD5>, C<NTLM>, and C<PLAIN>.  With
C<AUTO>, all available types will be tried.  When the Authen::NTLM
is not installed, the C<NTLM> option will silently be skipped.  Be warned
that, because of C<PLAIN>, erroneous username/password combinations will
be passed readible as last attempt!

The C<NTLM> authentication requires Authen::NTLM to be installed.  Other
methods may be added later.  Besides, you may also specify a CODE
reference which implements some authentication.

An ARRAY as TYPE can be used to specify both mechanism as callback.  When
no array is used, callback of the pair is set to C<undef>.  See
L<Mail::IMAPClient/authenticate> for the gory details.

example:

 $transporter->authentication('CRAM-MD5', [MY_AUTH => \&c], 'PLAIN');

 foreach my $pair ($transporter->authentication)
 {   my ($mechanism, $challange) = @$pair;
     ...
 }

=back

$obj-E<gt>B<domain>([DOMAIN])

=over 4

Used in NTLM authentication to define the Windows domain which is
accessed.  Initially set by L<new(domain)|Mail::Transport::IMAP4/"METHODS"> and defaults to the
server's name.

=back

=head2 Exchanging Information

=head2 Protocol [internals]

The follow methods handle protocol internals, and should not be used
by a normal user of this class.

$obj-E<gt>B<appendMessage>(MESSAGE, FOLDERNAME)

=over 4

Write the message to the server.

=back

$obj-E<gt>B<createFolder>(NAME)

=over 4

Add a folder.

=back

$obj-E<gt>B<createImapClient>(CLASS)

=over 4

Create an object of CLASS, which extends L<Mail::IMAPClient>.

=back

$obj-E<gt>B<currentFolder>([FOLDERNAME])

=over 4

Be sure that the specific FOLDER is the current one selected.  If the
folder is already selected, no IMAP traffic will be produced.

The boolean return value indicates whether the folder is selectable. It
will return undef if it does not exist.

=back

$obj-E<gt>B<deleteFolder>(NAME)

=over 4

Remove one folder.

=back

$obj-E<gt>B<destroyDeleted>(FOLDER)

=over 4

Command the server to delete for real all messages which are flagged to
be deleted.

=back

$obj-E<gt>B<fetch>(ARRAY-OF-MESSAGES, INFO)

=over 4

Get some INFO about the MESSAGES from the server.  The specified messages
shall extend L<Mail::Box::Net::Message|Mail::Box::Net::Message>, Returned is a list
of hashes, each info about one result.  The contents of the hash
differs per INFO, but at least a C<message> field will be present, to
relate to the message in question.

The right folder should be selected before this method is called. When
the connection was lost, C<undef> is returned.  Without any
messages, and empty array is returned.  The retrieval is done by
L<Mail::IMAPClient|Mail::IMAPClient> method C<fetch()>, which is then
parsed.

=back

$obj-E<gt>B<flagsToLabels>(WHAT|FLAGS)

Mail::Transport::IMAP4-E<gt>B<flagsToLabels>(WHAT|FLAGS)

=over 4

In SCALAR context, a hash with labels is returned.  In LIST context, pairs
are returned.

The WHAT parameter can be C<'SET'>, C<'CLEAR'>, or C<'REPLACE'>.  With the
latter, all standard imap flags do not appear in the list will be ignored:
their value may either by set or cleared.  See L<getFlags()|Mail::Transport::IMAP4/"Protocol [internals]">

Unknown flags in LIST are stripped from their backslash and lower-cased.
For instance, '\SomeWeirdFlag' will become `someweirdflag => 1'.

example: translating IMAP4 flags into MailBox flags

 my @flags  = ('\Seen', '\Flagged');
 my $labels = Mail::Transport::IMAP4->flags2labels(SET => @flags);

=back

$obj-E<gt>B<folders>([FOLDERNAME])

=over 4

Returns a list of folder names which are sub-folders of the specified
FOLDERNAME.  Without FOLDERNAME, the top-level foldernames are returned.

=back

$obj-E<gt>B<getFields>(UID, NAME, [NAME, ...])

=over 4

Get the records with the specified NAMES from the header.  The header
fields are returned as list of L<Mail::Message::Field::Fast|Mail::Message::Field::Fast> objects.
When the name is C<ALL>, the whole header is returned.

=back

$obj-E<gt>B<getFlags>(FOLDER, ID)

=over 4

Returns the values of all flags which are related to the message with the
specified ID.  These flags are translated into the names which are
standard for the MailBox suite.

A HASH is returned.  Names which do not appear will also provide
a value in the returned: the negative for the value is it was present.

=back

$obj-E<gt>B<getMessageAsString>(MESSAGE|UID)

=over 4

Returns the whole text of the specified message: the head and the body.

=back

$obj-E<gt>B<ids>

=over 4

Returns a list of UIDs which are defined by the IMAP server.

=back

$obj-E<gt>B<imapClient>

=over 4

Returns the object which implements the IMAP4 protocol, an instance
of a Mail::IMAPClient, which is logged-in and ready to use.

If the contact to the server was still present or could be established,
an Mail::IMAPClient object is returned.  Else, C<undef> is returned and
no further actions should be tried on the object.

=back

$obj-E<gt>B<labelsToFlags>(HASH|PAIRS)

Mail::Transport::IMAP4-E<gt>B<labelsToFlags>(HASH|PAIRS)

=over 4

Convert MailBox labels into IMAP flags.  Returned is a string.  Unsupported
labels are ignored.

=back

$obj-E<gt>B<listFlags>

=over 4

Returns all predefined flags as list.

=back

$obj-E<gt>B<login>

=over 4

Establish a new connection to the IMAP4 server, using username and password.

=back

$obj-E<gt>B<setFlags>(ID, LABEL, VALUE, [LABEL, VALUE], ...)

=over 4

Change the flags on the message which are represented by the label.  The
value which can be related to the label will be lost, because IMAP only
defines a boolean value, where MailBox labels can contain strings.

Returned is a list of LABEL=>VALUE pairs which could not be send to
the IMAP server.  These values may be cached in a different way.

=back

=head2 Error handling

$obj-E<gt>B<AUTOLOAD>

=over 4

See L<Mail::Reporter/"Error handling">

=back

$obj-E<gt>B<addReport>(OBJECT)

=over 4

See L<Mail::Reporter/"Error handling">

=back

$obj-E<gt>B<defaultTrace>([LEVEL]|[LOGLEVEL, TRACELEVEL]|[LEVEL, CALLBACK])

Mail::Transport::IMAP4-E<gt>B<defaultTrace>([LEVEL]|[LOGLEVEL, TRACELEVEL]|[LEVEL, CALLBACK])

=over 4

See L<Mail::Reporter/"Error handling">

=back

$obj-E<gt>B<errors>

=over 4

See L<Mail::Reporter/"Error handling">

=back

$obj-E<gt>B<log>([LEVEL [,STRINGS]])

Mail::Transport::IMAP4-E<gt>B<log>([LEVEL [,STRINGS]])

=over 4

See L<Mail::Reporter/"Error handling">

=back

$obj-E<gt>B<logPriority>(LEVEL)

Mail::Transport::IMAP4-E<gt>B<logPriority>(LEVEL)

=over 4

See L<Mail::Reporter/"Error handling">

=back

$obj-E<gt>B<logSettings>

=over 4

See L<Mail::Reporter/"Error handling">

=back

$obj-E<gt>B<notImplemented>

=over 4

See L<Mail::Reporter/"Error handling">

=back

$obj-E<gt>B<report>([LEVEL])

=over 4

See L<Mail::Reporter/"Error handling">

=back

$obj-E<gt>B<reportAll>([LEVEL])

=over 4

See L<Mail::Reporter/"Error handling">

=back

$obj-E<gt>B<trace>([LEVEL])

=over 4

See L<Mail::Reporter/"Error handling">

=back

$obj-E<gt>B<warnings>

=over 4

See L<Mail::Reporter/"Error handling">

=back

=head2 Cleanup

$obj-E<gt>B<DESTROY>

=over 4

The connection is cleanly terminated when the program is
terminated.

=back

$obj-E<gt>B<inGlobalDestruction>

=over 4

See L<Mail::Reporter/"Cleanup">

=back

=head1 DIAGNOSTICS

Error: Cannot connect to $host:$port for IMAP4: $!

=over 4

=back

Error: IMAP cannot connect to $host: $@

=over 4

=back

Notice: IMAP4 authenication $mechanism to $host:$port successful

=over 4

=back

Error: IMAP4 requires a username and password

=over 4

=back

Error: IMAP4 username $username requires a password

=over 4

=back

Error: Package $package does not implement $method.

=over 4

Fatal error: the specific package (or one of its superclasses) does not
implement this method where it should. This message means that some other
related classes do implement this method however the class at hand does
not.  Probably you should investigate this and probably inform the author
of the package.

=back

=head1 SEE ALSO

This module is part of Mail-Box distribution version 2.082,
built on April 28, 2008. Website: F<http://perl.overmeer.net/mailbox/>

=head1 LICENSE

Copyrights 2001-2008 by Mark Overmeer. For other contributors see ChangeLog.

This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
See F<http://www.perl.com/perl/misc/Artistic.html>


text:
package com.blogspot.shudiptotrafder.soilscience.adapter;

import android.annotation.SuppressLint;
import android.content.Context;
import android.database.Cursor;
import android.os.Build;
import android.support.v7.widget.CardView;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.blogspot.shudiptotrafder.soilscience.R;
import com.blogspot.shudiptotrafder.soilscience.animation.AnimationUtils;
import com.blogspot.shudiptotrafder.soilscience.utilities.ConstantUtils;
import com.blogspot.shudiptotrafder.soilscience.utilities.Utility;

import java.util.Random;

/**
 * Main cursor adapter for recycler view
 */
public class CustomCursorAdapter extends RecyclerView.Adapter<CustomCursorAdapter.MyViewHolder> {

    private Cursor mCursor;

    private final ItemClickListener clickListener;

    // Class variables for the Cursor that holds task data and the Context
    private final Context mContext;

    private int previousPosition = -1;

    /**
     * Constructor for the CustomCursorAdapter that initializes the Context.
     *
     * @param context the current Context
     */
    public CustomCursorAdapter(ItemClickListener clickListener,Context context) {
        this.clickListener = clickListener;
        mContext = context;
    }

    /**
     * set cursor from other activity
     * @param cursor new cursor for replace previous cursor
     */

    public void swapCursor(Cursor cursor) {

        mCursor = cursor;

        //check if this is a valid cursor, then update the cursor
        if (cursor != null) {
            this.notifyDataSetChanged();
        }
    }

    @Override
    public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(parent.getContext())
                .inflate(R.layout.main_recycler_view_list,parent,false);

        return new MyViewHolder(view);
    }

    @Override
    public void onBindViewHolder(MyViewHolder holder, @SuppressLint("RecyclerView") int position) {

        mCursor.moveToPosition(position);

        String word = mCursor.getString(ConstantUtils.INDEX_ONLY_WORD);
        holder.word.setText(word);
        holder.word.setTextSize(Utility.getTextSize(mContext));

        holder.itemView.setTag(word);

            if(position > previousPosition){
                //scrolling DOWN
                AnimationUtils.animate(holder, true);

            }else{
                // time for scrolling up
                AnimationUtils.animate(holder, false);
            }

            previousPosition = position;
    }

    @Override
    public void onViewDetachedFromWindow(MyViewHolder holder) {
        super.onViewDetachedFromWindow(holder);
        holder.itemView.clearAnimation();
    }

    @Override
    public int getItemCount() {

        if (mCursor == null){
            return 0;
        }

        return mCursor.getCount();
    }

    /**
     * This method for select word from database randomly
     * @return random word form database
     */
    public String getRandomWord(){

        String word = null;

        if (mCursor != null){

            int size = mCursor.getCount();

            Random random = new Random();
            int position = random.nextInt(size);
            if (position == 0){
                mCursor.moveToPosition(1);
            } else {
                mCursor.moveToPosition(position);
            }

            word = mCursor.getString(ConstantUtils.INDEX_ONLY_WORD);
        }

        //set analytics data
        Utility.setAnalyticsData(mContext,"Random Word",word);

        return word;
    }

    // Inner class for creating ViewHolders
    protected class MyViewHolder extends
            RecyclerView.ViewHolder implements View.OnClickListener {

        // Class variables for the task description and priority TextViews
        final TextView word;
        CardView cardView;
        /**
         * Constructor for the TaskViewHolders.
         *
         * @param itemView The view inflated in onCreateViewHolder
         */
        MyViewHolder(View itemView) {
            super(itemView);

            word = itemView.findViewById(R.id.mainRecycleView_TV);

            if (Build.VERSION.SDK_INT >= 21){
                cardView = itemView.findViewById(R.id.mainRecycleView_Card);
                cardView.setOnClickListener(this);

            } else {
                word.setOnClickListener(this);
            }

        }

        @Override
        public void onClick(View v) {
            mCursor.moveToPosition(getAdapterPosition());
            String word = mCursor.getString(ConstantUtils.INDEX_ONLY_WORD);
            //pass word
            clickListener.onItemClickListener(word);
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="wfcSpnFormat">Bellen via wifi van %s</string>
</resources>


text:
package org.springframework.boot.maven;

import java.io.File;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import java.util.function.Consumer;

import org.apache.maven.execution.MavenSession;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.toolchain.Toolchain;
import org.apache.maven.toolchain.ToolchainManager;

import org.springframework.boot.loader.tools.JavaExecutable;
import org.springframework.boot.loader.tools.RunProcess;

/**
 * Ease the execution of a Java process using Maven's toolchain support.
 *
 * @author Stephane Nicoll
 */
class JavaProcessExecutor {

	private static final int EXIT_CODE_SIGINT = 130;

	private final MavenSession mavenSession;

	private final ToolchainManager toolchainManager;

	private final Consumer<RunProcess> runProcessCustomizer;

	JavaProcessExecutor(MavenSession mavenSession, ToolchainManager toolchainManager) {
		this(mavenSession, toolchainManager, null);
	}

	private JavaProcessExecutor(MavenSession mavenSession, ToolchainManager toolchainManager,
			Consumer<RunProcess> runProcessCustomizer) {
		this.mavenSession = mavenSession;
		this.toolchainManager = toolchainManager;
		this.runProcessCustomizer = runProcessCustomizer;
	}

	JavaProcessExecutor withRunProcessCustomizer(Consumer<RunProcess> customizer) {
		Consumer<RunProcess> combinedCustomizer = (this.runProcessCustomizer != null)
				? this.runProcessCustomizer.andThen(customizer) : customizer;
		return new JavaProcessExecutor(this.mavenSession, this.toolchainManager, combinedCustomizer);
	}

	int run(File workingDirectory, List<String> args, Map<String, String> environmentVariables)
			throws MojoExecutionException {
		RunProcess runProcess = new RunProcess(workingDirectory, getJavaExecutable());
		if (this.runProcessCustomizer != null) {
			this.runProcessCustomizer.accept(runProcess);
		}
		try {
			int exitCode = runProcess.run(true, args, environmentVariables);
			if (!hasTerminatedSuccessfully(exitCode)) {
				throw new MojoExecutionException("Process terminated with exit code: " + exitCode);
			}
			return exitCode;
		}
		catch (IOException ex) {
			throw new MojoExecutionException("Process execution failed", ex);
		}
	}

	RunProcess runAsync(File workingDirectory, List<String> args, Map<String, String> environmentVariables)
			throws MojoExecutionException {
		try {
			RunProcess runProcess = new RunProcess(workingDirectory, getJavaExecutable());
			runProcess.run(false, args, environmentVariables);
			return runProcess;
		}
		catch (IOException ex) {
			throw new MojoExecutionException("Process execution failed", ex);
		}
	}

	private boolean hasTerminatedSuccessfully(int exitCode) {
		return (exitCode == 0 || exitCode == EXIT_CODE_SIGINT);
	}

	private String getJavaExecutable() {
		Toolchain toolchain = this.toolchainManager.getToolchainFromBuildContext("jdk", this.mavenSession);
		String javaExecutable = (toolchain != null) ? toolchain.findTool("java") : null;
		return (javaExecutable != null) ? javaExecutable : new JavaExecutable().toString();
	}

}


text:
<?php

namespace Backend\Modules\Faq\Installer;

use Backend\Core\Installer\ModuleInstaller;
use Common\ModuleExtraType;

/**
 * Installer for the faq module
 */
class Installer extends ModuleInstaller
{
    /** @var int */
    private $defaultCategoryId;

    /** @var int */
    private $faqBlockId;

    public function install(): void
    {
        $this->addModule('Faq');
        $this->makeSearchable($this->getModule());
        $this->importSQL(__DIR__ . '/Data/install.sql');
        $this->importLocale(__DIR__ . '/Data/locale.xml');
        $this->configureSettings();
        $this->configureBackendNavigation();
        $this->configureBackendRights();
        $this->configureBackendWidgets();
        $this->configureFrontendExtras();
        $this->configureFrontendPages();
    }

    private function configureBackendActionRightsForFaqCategory(): void
    {
        $this->setActionRights(1, $this->getModule(), 'AddCategory');
        $this->setActionRights(1, $this->getModule(), 'Categories');
        $this->setActionRights(1, $this->getModule(), 'DeleteCategory');
        $this->setActionRights(1, $this->getModule(), 'EditCategory');
        $this->setActionRights(1, $this->getModule(), 'Sequence'); // AJAX
    }

    private function configureBackendActionRightsForFaqQuestion(): void
    {
        $this->setActionRights(1, $this->getModule(), 'Add');
        $this->setActionRights(1, $this->getModule(), 'Delete');
        $this->setActionRights(1, $this->getModule(), 'Edit');
        $this->setActionRights(1, $this->getModule(), 'Index');
        $this->setActionRights(1, $this->getModule(), 'SequenceQuestions'); // AJAX
    }

    private function configureBackendActionRightsForFaqQuestionFeedback(): void
    {
        $this->setActionRights(1, $this->getModule(), 'DeleteFeedback');
    }

    private function configureBackendNavigation(): void
    {
        // Set navigation for "Modules"
        $navigationModulesId = $this->setNavigation(null, 'Modules');
        $navigationFaqId = $this->setNavigation($navigationModulesId, $this->getModule());
        $this->setNavigation(
            $navigationFaqId,
            'Questions',
            'faq/index',
            ['faq/add', 'faq/edit']
        );
        $this->setNavigation(
            $navigationFaqId,
            'Categories',
            'faq/categories',
            ['faq/add_category', 'faq/edit_category']
        );

        // Set navigation for "Settings"
        $navigationSettingsId = $this->setNavigation(null, 'Settings');
        $navigationModulesId = $this->setNavigation($navigationSettingsId, 'Modules');
        $this->setNavigation($navigationModulesId, $this->getModule(), 'faq/settings');
    }

    private function configureBackendRights(): void
    {
        $this->setModuleRights(1, $this->getModule());

        // Configure backend rights for entities
        $this->configureBackendActionRightsForFaqCategory();
        $this->configureBackendActionRightsForFaqQuestion();
        $this->configureBackendActionRightsForFaqQuestionFeedback();

        $this->setActionRights(1, $this->getModule(), 'Settings');
    }

    private function configureBackendWidgets(): void
    {
        $this->insertDashboardWidget($this->getModule(), 'Feedback');
    }

    /**
     * Configure frontend extras
     * Note: Category faq widgets will be added on the fly
     */
    private function configureFrontendExtras(): void
    {
        $this->faqBlockId = $this->insertExtra($this->getModule(), ModuleExtraType::block(), $this->getModule());
        $this->insertExtra($this->getModule(), ModuleExtraType::widget(), 'MostReadQuestions', 'MostReadQuestions');
        $this->insertExtra($this->getModule(), ModuleExtraType::widget(), 'AskOwnQuestion', 'AskOwnQuestion');
        $this->insertExtra($this->getModule(), ModuleExtraType::widget(), 'Categories', 'Categories');
    }

    private function configureFrontendPages(): void
    {
        foreach ($this->getLanguages() as $language) {
            $this->defaultCategoryId = $this->getDefaultCategoryIdForLanguage($language);

            // no category exists
            if ($this->defaultCategoryId === 0) {
                $this->defaultCategoryId = $this->insertCategory($language, 'Default', 'default');
            }

            // check if a page for the faq already exists in this language
            $faqPageExists = (bool) $this->getDatabase()->getVar(
                'SELECT 1
                 FROM pages AS p
                 INNER JOIN pages_blocks AS b ON b.revision_id = p.revision_id
                 WHERE b.extra_id = ? AND p.language = ?
                 LIMIT 1',
                [$this->faqBlockId, $language]
            );

            if (!$faqPageExists) {
                // insert page
                $this->insertPage(
                    [
                        'title' => 'FAQ',
                        'language' => $language,
                    ],
                    null,
                    ['extra_id' => $this->faqBlockId]
                );
            }
        }
    }

    private function configureSettings(): void
    {
        $this->setSetting($this->getModule(), 'allow_feedback', false);
        $this->setSetting($this->getModule(), 'allow_multiple_categories', true);
        $this->setSetting($this->getModule(), 'allow_own_question', false);
        $this->setSetting($this->getModule(), 'most_read_num_items', 5);
        $this->setSetting($this->getModule(), 'overview_num_items_per_category', 10);
        $this->setSetting($this->getModule(), 'related_num_items', 5);
        $this->setSetting($this->getModule(), 'send_email_on_new_feedback', false);
        $this->setSetting($this->getModule(), 'spamfilter', false);
    }

    private function getDefaultCategoryIdForLanguage(string $language): int
    {
        return (int) $this->getDatabase()->getVar(
            'SELECT id
             FROM faq_categories
             WHERE language = ?',
            [$language]
        );
    }

    /**
     * @todo: When FAQ entities are available, use DataFixtures instead of this method.
     *
     * @param string $language
     * @param string $title
     * @param string $url
     *
     * @return int
     */
    private function insertCategory(string $language, string $title, string $url): int
    {
        $database = $this->getDatabase();

        // get sequence for widget
        $sequenceExtra = $database->getVar(
            'SELECT MAX(i.sequence) + 1
             FROM modules_extras AS i
             WHERE i.module = ?',
            ['faq']
        );

        // build array
        $item = [];
        $item['meta_id'] = $this->insertMeta($title, $title, $title, $url);
        $item['extra_id'] = $this->insertExtra(
            $this->getModule(),
            ModuleExtraType::widget(),
            $this->getModule(),
            'CategoryList',
            null,
            false,
            $sequenceExtra
        );
        $item['language'] = $language;
        $item['title'] = $title;
        $item['sequence'] = 1;

        // insert category
        $item['id'] = (int) $database->insert('faq_categories', $item);

        // build data for widget
        $extra = [
            'data' => serialize(
                [
                    'id' => $item['id'],
                    'extra_label' => 'Category: ' . $item['title'],
                    'language' => $item['language'],
                    'edit_url' => '/private/' . $language . '/faq/edit_category?id=' . $item['id'],
                ]
            ),
        ];

        // update widget
        $database->update(
            'modules_extras',
            $extra,
            'id = ? AND module = ? AND type = ? AND action = ?',
            [$item['extra_id'], $this->getModule(), ModuleExtraType::widget(), 'category_list']
        );

        return $item['id'];
    }
}


text:
birds = ['Owl', 'Macaw', 'Parrot', 'BeeHumming']

# Return the number of x appears in the list
print('\nCount: ' + str(birds.count('Macaw')))

# Return zero-based index in the list, Raises a ValueError if no item exist
print('\nIndex: ' + str(birds.index('Parrot')))

# Reverse the elements of the list in place
print('\nReverse: ')
birds.reverse()
print(birds)

# Sort
print('\nSort: ')
birds.sort()
print(birds)

# Append
print('\nAppend Penguin')
birds.append('Penguin')
print(birds)

# Insert
print('\nInsert Kingfisher on index 3')
birds.insert(3, 'Kingfisher')
print(birds)

# Pop
print('\nPop bird on index 3')
birds.pop(3)
print(birds)

# Remove
print('\nRemove bird Penguin')
birds.remove('Penguin')
print(birds)

# clear
print('\nClear birds list')
birds.clear()
print(birds)


text:
// REngine - generic Java/R API
//
// Copyright (C) 2006 Simon Urbanek
// --- for licensing information see LICENSE file in the original JRclient distribution ---
//
//  RSrvException.java
//
//  Created by Simon Urbanek on Wed Jun 21 2006.
//
//  $Id$
//

package org.rosuda.REngine;

/** REngineException is a generic exception that can be thrown by methods invoked on an R engine. */
public class REngineException extends Exception {
	/** engine associated with this exception */
    protected REngine engine;

    /** creates an R engine exception
	@param engine engine associated with this exception
	@param msg message describing the cause
	@param cause original cause if this is a chained exception
    */
    public REngineException(REngine engine, String msg, Throwable cause) {
        super(msg, cause);
        this.engine = engine;
    }

    /** creates an R engine exception
	@param engine engine associated with this exception
	@param msg message describing the cause
    */
    public REngineException(REngine engine, String msg) {
        super(msg);
        this.engine = engine;
    }

    /** returns the engine associated with this exception
	@return engine associated with this exception */
    public REngine getEngine() { return engine; }
}


text:
<?xml version="1.0"?>
<TEI xmlns="http://www.tei-c.org/ns/1.0">
<teiHeader>
<fileDesc>
<titleStmt>
<title>Moby-Dick; or, The Whale</title>
<title type="gmd">[electronic resource]</title>
<author>Herman Melville</author>
<respStmt>
<resp>Creation of machine-readable version</resp>
<name>Keyboarded by Aptara, Inc.</name>
</respStmt>
<respStmt>
<resp>Creation of digital images</resp>
<name>Aptara, Inc.</name>
</respStmt>
<respStmt>
<resp>Conversion to TEI-conformant markup</resp>
<name>Aptara, Inc.</name>
</respStmt>
</titleStmt>
<extent>ca. 1,498,198 kilobytes</extent>
<publicationStmt>
<publisher>Harper & Brothers, Publishers</publisher>
<pubPlace>New York</pubPlace>
<idno type="ETC">Modern English, MelMoby</idno>
<availability status="unknown">

Publicly accessible

URL: http://www.nzetc.org/collections.html

Herman Melville

</availability>
<date>1851</date>
</publicationStmt>
<sourceDesc>
<biblFull>
<titleStmt>
<title>Moby-Dick; or, The Whale</title>
<author>Herman Melville</author>
</titleStmt>
<editionStmt>

</editionStmt>
<extent/>
<publicationStmt>
<publisher>Harper & Brothers, Publishers</publisher>
<pubPlace>New York</pubPlace>
<idno type="callNo">Source copy consulted: MelMoby</idno>
</publicationStmt>
</biblFull>
</sourceDesc>
</fileDesc>
</teiHeader>
<text xml:id="t1">
<front xml:id="t1-front">
<pb xml:id="n1"/>
<pb xml:id="n2"/>
<pb xml:id="n3"/>
<pb xml:id="n4"/>
<pb xml:id="n5"/>
<pb xml:id="n6"/>
<pb xml:id="n7"/>
<pb xml:id="n8"/>
<pb xml:id="n9"/>
<pb xml:id="n10"/>
<pb xml:id="n11"/>
<pb xml:id="n12"/>
<pb xml:id="n13"/>
<pb xml:id="n14"/>
<titlePage xml:id="t1-front-d1-d1">
<docTitle>
<titlePart type="main"><hi rend="c">Moby-Dick</hi>; <hi rend="sc">or</hi>, <hi rend="c">The Whale</hi></titlePart>
</docTitle>
<docAuthor><hi rend="c">Herman Melville</hi></docAuthor><lb/>
<byline/>
<docImprint>
<hi rend="sc">author of</hi>
<hi rend="sc">“typee” “omoo” “redburn” “mardi” “white-jacket”</hi>
<publisher>
<hi rend="b"><hi rend="c">New York:</hi></hi><lb/>
<hi rend="b"><hi rend="c">Harper & Brothers, Publishers</hi></hi>.<lb/>
<hi rend="b"><hi rend="c">London: Richard Bentley</hi></hi>.<lb/>
<date>1851</date>
</publisher>
</docImprint>
</titlePage>
<pb xml:id="n15"/>
<div1 xml:id="t1-front-d1" type="copyright">

Entered, according to Act of Congress, in the year 1851, by<lb/>
HERMAN MELVILLE,<lb/>
In the Clerk's Office of the District Court of the Southern District of New York.

</div1>
<pb xml:id="n16"/>
<div1 xml:id="t1-front-d2" type="inscribe">

<hi rend="sc">in token</hi><lb/>
<hi rend="sc">of my admiration for his genius</hi>.<lb/>
This Book is Inscribed<lb/>
<hi rend="sc">to</hi><lb/>
NATHANIEL HAWTHORNE.

</div1>
<pb xml:id="n17"/>
<pb xml:id="n18"/>
<pb xml:id="n21"/>
<pb xml:id="n23"/>
<pb xml:id="n24"/>
</front>

<pb xml:id="n37"/>
<pb xml:id="n38" n="1"/>
<div1 xml:id="t1-body-d1" type="chapter">
CHAPTER I.<lb/>
<hi rend="sc">loomings</hi>.

<hi rend="sc">Call</hi> me Ishmael. Some years ago—never mind how long<lb/>
precisely—having little or no money in my purse, and nothing<lb/>
particular to interest me on shore, I thought I would sail about<lb/>
a little and see the watery part of the world. It is a way I have<lb/>
of driving off the spleen, and regulating the circulation. When-<lb/>
ever I find myself growing grim about the mouth; whenever it<lb/>
is a damp, drizzly November in my soul; whenever I find myself<lb/>
involuntarily pausing before coffin warehouses, and bringing up<lb/>
the rear of every funeral I meet; and especially whenever my<lb/>
hypos get such an upper hand of me, that it requires a strong<lb/>
moral principle to prevent me from deliberately stepping into<lb/>
the street, and methodically knocking people's hats off—then, I<lb/>
account it high time to get to sea as soon as I can. This is my<lb/>
substitute for pistol and ball. With a philosophical flourish<lb/>
Cato throws himself upon his sword; I quietly take to the<lb/>
ship. There is nothing surprising in this. If they but knew it,<lb/>
almost all men in their degree, some time or other, cherish very<lb/>
nearly the same feelings towards the ocean with me.

There now is your insular city of the Manhattoes, belted<lb/>
round by wharves as Indian isles by coral reefs—commerce sur-<lb/>
rounds it with her surf. Right and left, the streets take you<lb/>
waterward. Its extreme down-town is the battery, where that<lb/>
noble mole is washed by waves, and cooled by breezes, which<lb/>
a few hours previous were out of sight of land. Look at the<lb/>
crowds of water-gazers there.

Circumambulate the city of a dreamy Sabbath afternoon.<lb/>
Go from Corlears Hook to Coenties Slip, and from thence, by<lb/>
<pb xml:id="n39" n="2"/>
Whitehall, northward. What do you see?—Posted like silent<lb/>
sentinels all around the town, stand thousands upon thousands<lb/>
of mortal men fixed in ocean reveries. Some leaning against the<lb/>
spiles; some seated upon the pier-heads; some looking over the<lb/>
bulwarks of ships from China; some high aloft in the rigging,<lb/>
as if striving to get a still better seaward peep. But these are<lb/>
all landsmen; of week days pent up in lath and plaster—tied<lb/>
to counters, nailed to benches, clinched to desks. How then<lb/>
is this? Are the green fields gone? What do they here?

But look! here come more crowds, pacing straight<lb/>
for the water, and seemingly bound for a dive. Strange! Nothing<lb/>
will content them but the extremest limit of the land; loitering<lb/>
under the shady lee of yonder warehouses will not suffice. No.<lb/>
They must get just as nigh the water as they possibly can<lb/>
without falling in. And there they stand—miles of them—<lb/>
leagues. Inlanders all, they come from lanes and alleys, streets<lb/>
and avenues—north, east, south, and west. Yet here they all<lb/>
unite. Tell me, does the magnetic virtue of the needles of the<lb/>
compasses of all those ships attract them thither?

Once more. Say, you are in the country; in some high<lb/>
land of lakes. Take almost any path you please, and ten to one<lb/>
it carries you down in a dale, and leaves you there by a pool in<lb/>
the stream. There is magic in it. Let the most absent-minded<lb/>
of men be plunged in his deepest reveries—stand that man on<lb/>
his legs, set his feet a-going, and he will infallibly lead you to<lb/>
water, if water there be in all that region. Should you ever be<lb/>
athirst in the great American desert, try this experiment, if your<lb/>
caravan happen to be supplied with a metaphysical professor.<lb/>
Yes, as every one knows, meditation and water are wedded for<lb/>
ever.

But here is an artist. He desires to paint you the dream-<lb/>
iest, shadiest, quietest, most enchanting bit of romantic land-<lb/>
scape in all the valley of the Saco. What is the chief element<lb/>
he employs? There stand his trees, each with a hollow trunk,<lb/>
<pb xml:id="n40" n="3"/>
as if a hermit and a crucifix were within; and here sleeps his<lb/>
meadow, and there sleep his cattle; and up from yonder cottage<lb/>
goes a sleepy smoke. Deep into distant woodlands winds a<lb/>
mazy way, reaching to overlapping spurs of mountains bathed<lb/>
in their hill-side blue. But though the picture lies thus<lb/>
tranced, and though this pine-tree shakes down its sighs like<lb/>
leaves upon this shepherd's head, yet all were vain, unless the<lb/>
shepherd's eye were fixed upon the magic stream before him.<lb/>
Go visit the Prairies in June, when for scores on scores of<lb/>
miles you wade knee-deep among Tiger-lilies—what is the<lb/>
one charm wanting?—Water—there is not a drop of water<lb/>
there! Were Niagara but a cataract of sand, would you<lb/>
travel your thousand miles to see it? Why did the poor poet<lb/>
of Tennessee, upon suddenly receiving two handfuls of silver,<lb/>
deliberate whether to buy him a coat, which he sadly<lb/>
needed, or invest his money in a pedestrian trip to Rockaway<lb/>
Beach? Why is almost every robust healthy boy with a<lb/>
robust healthy soul in him, at some time or other crazy to go<lb/>
to sea? Why upon your first voyage as a passenger, did you<lb/>
yourself feel such a mystical vibration, when first told that you<lb/>
and your ship were now out of sight of land? Why did the,<lb/>
old Persians hold the sea holy? Why did the Greeks give it<lb/>
a separate deity, and own brother of Jove? Surely all this is<lb/>
not without meaning. And still deeper the meaning of that<lb/>
story of Narcissus, who because he could not grasp the torment-<lb/>
ing, mild image he saw in the fountain, plunged into it and<lb/>
was drowned. But that same image, we ourselves see in all rivers<lb/>
and oceans. It is the image of the ungraspable phantom of<lb/>
life; and this is the key to it all.

Now, when I say that I am in the habit of going to sea<lb/>
whenever I begin to grow hazy about the eyes, and begin to be<lb/>
over conscious of my lungs, I do not mean to have it inferred<lb/>
that I ever go to sea as a passenger. For to go as a passenger<lb/>
you must needs have a purse, and a purse is but a rag unless<lb/>
<pb xml:id="n41" n="4"/>
you have something in it. Besides, passengers get sea-sick—<lb/>
grow quarrelsome—don't sleep of nights—do not enjoy them-<lb/>
selves much, as a general thing;—no, I never go as a passen-<lb/>
ger; nor, though I am something of a salt, do I ever<lb/>
go to sea as a Commodore, or a Captain, or a Cook. I aban-<lb/>
don the glory and distinction of such offices to those who like<lb/>
them. For my part, I abominate all honorable respectable<lb/>
toils, trials, and tribulations of every kind whatsoever. It is<lb/>
quite as much as I can do to take care of myself, without<lb/>
taking care of ships, barques, brigs, schooners, and what not.<lb/>
And as for going as cook,—though I confess there is considerable<lb/>
glory in that, a cook being a sort of officer on ship-board—<lb/>
yet, somehow, I never fancied broiling fowls;—though once<lb/>
broiled, judiciously buttered, and judgmatically salted and<lb/>
peppered, there is no one who will speak more respectfully, not<lb/>
to say reverentially, of a broiled fowl than I will. It is out of<lb/>
the idolatrous dotings of the old Egyptians upon broiled ibis<lb/>
and roasted river horse, that you see the mummies of those<lb/>
creatures in their huge bake-houses the pyramids.

No, when I go to sea, I go as a simple sailor, right before<lb/>
the mast, plumb down into the forecastle, aloft there<lb/>
to the royal mast-head. True, they rather order me about some, and<lb/>
make me jump from spar to spar, like a grasshopper in a<lb/>
May meadow. And at first, this sort of thing is unpleasant<lb/>
enough. It touches one's sense of honor, particularly if you<lb/>
come of an old established family in the land, the Van Rensse-<lb/>
laers, or Randolphs, or Hardicanutes. And more than all,<lb/>
if just previous to putting your hand into the tar-pot, you have<lb/>
been lording it as a country schoolmaster, making the tallest<lb/>
boys stand in awe of you. The transition is a keen one, I<lb/>
assure you, from a schoolmaster to a sailor, and requires a strong<lb/>
decoction of Seneca and the Stoics to enable you to grin and<lb/>
bear it. But even this wears off in time.

What of it, if some old hunks of a sea-captain orders me to<lb/>
<pb xml:id="n42" n="5"/>
get a broom and sweep down the decks? What does that<lb/>
indignity amount to, weighed, I mean, in the scales of the New<lb/>
Testament? Do you think the archangel Gabriel thinks any-<lb/>
thing the less of me, because I promptly and respectfully obey<lb/>
that old hunks in that particular instance? Who aint a slave?<lb/>
Tell me that. Well, then, however the old sea-captains may<lb/>
order me about—however they may thump and punch me<lb/>
about, I have the satisfaction of knowing that it is all right;<lb/>
that everybody else is one way or other served in much the<lb/>
same way—either in a physical or metaphysical point of view,<lb/>
that is; and so the universal thump is passed round, and all<lb/>
hands should rub each other's shoulder-blades, and be con-<lb/>
tent.

Again, I always go to sea as a sailor, because they make<lb/>
a point of paying me for my trouble, whereas they never pay<lb/>
passengers a single penny that I ever heard of. On the con-<lb/>
trary, passengers themselves must pay. And there is all the<lb/>
difference in the world between paying and being paid. The<lb/>
act of paying is perhaps the most uncomfortable infliction that<lb/>
the two orchard thieves entailed upon us. But <hi rend="i">being paid</hi>,<lb/>
—what will compare with it? The urbane activity with which a<lb/>
man receives money is really marvellous, considering that we so<lb/>
earnestly believe money to be the root of all earthly ills, and<lb/>
that on no account can a monied man enter heaven. Ah! how<lb/>
cheerfully we consign ourselves to perdition!

Finally, I always go to sea as a sailor, because of the whole-<lb/>
some exercise and pure air of the forecastle deck. For as<lb/>
in this world, head winds are far more prevalent than winds from<lb/>
astern (that is, if you never violate the Pythagorean maxim), so<lb/>
for the most part the Commodore on the quarter-deck gets his<lb/>
atmosphere at second hand from the sailors on the forecastle.<lb/>
He thinks he breathes it first; but not so. In much the same<lb/>
way do the commonalty lead their leaders in many other<lb/>
things, at the same time that the leaders little suspect it. But<lb/>
<pb xml:id="n43" n="6"/>
wherefore it was that after having repeatedly smelt the sea as a<lb/>
merchant sailor, I should now take it into my head to go on a<lb/>
whaling voyage; this the invisible police officer of the Fates, who<lb/>
has the constant surveillance of me, and secretly dogs me, and<lb/>
influences me in some unaccountable way—he can better answer<lb/>
than any one else. And, doubtless, my going on this whaling<lb/>
voyage, formed part of the grand programme of Providence that<lb/>
was drawn up a long time ago. It came in as a sort of brief<lb/>
interlude and solo between more extensive performances. I take<lb/>
it that this part of the bill must have run something like this:

“<hi rend="i">Grand Contested Election for the Presidency of the United States.</hi><lb/>
“WHALING VOYAGE BY ONE ISHMAEL.<lb/>
“BLOODY BATTLE IN AFFGHANISTAN.”

Though I cannot tell why it was exactly that those stage<lb/>
managers, the Fates, put me down for this shabby part of a<lb/>
whaling voyage, when others were set down for magnificent<lb/>
parts in high tragedies, and short and easy parts in genteel<lb/>
comedies, and jolly parts in farces—though I cannot tell why<lb/>
this was exactly; yet, now that I recall all the circumstances, I<lb/>
think I can see a little into the springs and motives which being<lb/>
cunningly presented to me under various disguises, induced me<lb/>
to set about performing the part I did, besides cajoling me into<lb/>
the delusion that it was a choice resulting from my own unbiased<lb/>
freewill and discriminating judgment.

Chief among these motives was the overwhelming idea of the<lb/>
great whale himself. Such a portentous and mysterious monster<lb/>
roused all my curiosity. Then the wild and distant seas where<lb/>
he rolled his island bulk; the undeliverable, nameless perils of<lb/>
the whale; these, with all the attending marvels of a thousand<lb/>
Patagonian sights and sounds, helped to sway me to my wish.<lb/>
With other men, perhaps, such things would not have been<lb/>
inducements; but as for me, I am tormented with an everlas-<lb/>
ting itch for things remote. I love to sail forbidden seas, and<lb/>
<pb xml:id="n44" n="7"/>
land on barbarous coasts. Not ignoring what is good, I am<lb/>
quick to perceive a horror, and could still be social with it<lb/>
—would they let me—since it is but well to be on friendly<lb/>
terms with all the inmates of the place one lodges in.

By reason of these things, then, the whaling voyage was wel-<lb/>
come; the great flood-gates of the wonder-world swung open,<lb/>
and in the wild conceits that swayed me to my purpose, two<lb/>
and two there floated into my inmost soul, endless processions<lb/>
of the whale, and, mid most of them all, one grand hooded phan-<lb/>
tom, like a snow hill in the air.

</div1>
<pb xml:id="n680"/>
<pb xml:id="n681"/>
<pb xml:id="n682"/>
<pb xml:id="n683"/>
<pb xml:id="n684"/>
<pb xml:id="n685"/>
<pb xml:id="n686"/>
<pb xml:id="n687"/>
<pb xml:id="n688"/>

</text>
</TEI>


text:
<?xml version="1.0" encoding="utf-8"?>
<TableLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/show1"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
	>
	<RelativeLayout
         android:layout_width="match_parent"
         android:layout_height="50sp"
         android:layout_marginTop="0dp"
         android:background="@drawable/haha"
         >
         <TextView
            android:id="@+id/top_return"
            android:layout_alignParentLeft="true"
            android:layout_centerVertical="true"
            android:gravity="right"
        	android:layout_width="50sp"
         	android:layout_height="wrap_content"
			android:text="返回"
			android:textSize="20sp"
            />
         <TextView
           	  android:id="@+id/regist_top_text1"
              android:layout_centerInParent="true"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:text="注册账号"
              android:textColor="#f00"
              android:textSize="35sp"
              />
  	</RelativeLayout>
  	<TextView
  	    android:id="@+id/top_text"
  	    android:layout_width="match_parent"
  	    android:layout_height="30sp"
  	    android:gravity="center"
  	    android:textColor="@drawable/red"
	    android:textSize="25sp"
  	    />
  	<TableLayout
	    android:layout_width="wrap_content"
	    android:layout_height="40sp"
	    >
		<TableRow
	    android:layout_width="match_parent"
	    android:layout_height="wrap_content"
	    >
         <TextView
	        android:layout_width="80sp"
	        android:layout_height="wrap_content"
	        android:textColor="@drawable/red"
	        android:textSize="20sp"
	        android:gravity="center_horizontal"
	        android:text="账号"
	        />
	    <EditText
	        android:id="@+id/edit1"
	        android:layout_width="220sp"
	        android:layout_height="wrap_content"
	        android:singleLine="true"
	        android:phoneNumber="true"
	        android:textColor="@drawable/red"
	        android:textSize="25sp"
	        />
	</TableRow>
	</TableLayout>
	<TableLayout
	    android:layout_width="wrap_content"
	    android:layout_height="40sp"
	    >
		<TableRow
	    android:layout_width="match_parent"
	    android:layout_height="wrap_content"
	    >
         <TextView
	        android:layout_width="80sp"
	        android:layout_height="wrap_content"
	        android:textColor="@drawable/red"
	        android:textSize="20sp"
	        android:gravity="center_horizontal"
	        android:text="密码"
	        />
	    <EditText
	        android:id="@+id/edit2"
	        android:layout_width="220sp"
	        android:layout_height="wrap_content"
	        android:inputType="textPassword"
	        android:singleLine="true"
	        android:textColor="@drawable/red"
	        android:textSize="25sp"
	        />
	</TableRow>
	</TableLayout>
	<TableLayout
	    android:layout_width="wrap_content"
	    android:layout_height="40sp"
	    >
		<TableRow
	    android:layout_width="match_parent"
	    android:layout_height="wrap_content"
	    >
         <TextView
	        android:layout_width="80sp"
	        android:layout_height="wrap_content"
	        android:textColor="@drawable/red"
	        android:textSize="20sp"
	        android:gravity="center_horizontal"
	        android:text="确认密码"
	        />
	    <EditText
	        android:id="@+id/edit3"
	        android:layout_width="220sp"
	        android:layout_height="wrap_content"
	        android:inputType="textPassword"
	        android:singleLine="true"
	        android:textColor="@drawable/red"
	        android:textSize="25sp"
	        />
	</TableRow>
	</TableLayout>
	<TableLayout
	    android:layout_width="wrap_content"
	    android:layout_height="40sp"
	    >
		<TableRow
	    android:layout_width="match_parent"
	    android:layout_height="wrap_content"
	    >
         <TextView
	        android:layout_width="80sp"
	        android:layout_height="40sp"
	        android:gravity="center"
	        android:textColor="@drawable/red"
	        android:textSize="20sp"
	        android:text="性别"
	        />
	   	 <RadioGroup
	   	     android:id="@+id/rg"
	   	     android:orientation="horizontal"
	   	     android:gravity="center"
	   	     >
	   	     <RadioButton
	   	         android:layout_width="wrap_content"
	   	         android:layout_height="wrap_content"
	   	         android:id="@+id/male"
	   	         android:text="男"
	   	         android:checked="true"
	   	         android:textColor="@drawable/red"
	   	         android:textSize="25sp"
	   	         />
	   	     <RadioButton
	   	         android:layout_width="wrap_content"
	   	         android:layout_height="wrap_content"
	   	         android:id="@+id/female"
	   	         android:text="女"
	   	         android:textColor="@drawable/red"
	   	         android:textSize="25sp"
	   	         />
	   	     <RadioButton
	   	         android:layout_width="wrap_content"
	   	         android:layout_height="wrap_content"
	   	         android:id="@+id/other"
	   	         android:text="其他"
	   	         android:textColor="@drawable/red"
	   	         android:textSize="25sp"
	   	         />
	   	 </RadioGroup>
	</TableRow>
	</TableLayout>

	<TextView
  	    android:layout_width="match_parent"
  	    android:layout_height="30sp"
  	    android:gravity="center"
  	    android:textColor="@drawable/red"
	    android:textSize="15sp"
	    android:text="选填:"
  	    />
	<TableLayout
	    android:layout_width="wrap_content"
	    android:layout_height="40sp"
	    >
		<TableRow
	    android:layout_width="match_parent"
	    android:layout_height="wrap_content"
	    >
         <TextView
	        android:layout_width="80sp"
	        android:layout_height="wrap_content"
	        android:textColor="@drawable/red"
	        android:textSize="20sp"
	        android:gravity="center_horizontal"
	        android:text="电话号码"
	        />
	    <EditText
	        android:id="@+id/edit4"
	        android:layout_width="220sp"
	        android:layout_height="wrap_content"
	        android:inputType="phone"
	        android:singleLine="true"
	        android:textColor="@drawable/red"
	        android:textSize="20sp"
	        />
	</TableRow>
	</TableLayout>
	<TableLayout
	    android:layout_width="wrap_content"
	    android:layout_height="40sp"
	    >
		<TableRow
	    android:layout_width="match_parent"
	    android:layout_height="wrap_content"
	    >
         <TextView
	        android:layout_width="80sp"
	        android:layout_height="wrap_content"
	        android:textColor="@drawable/red"
	        android:textSize="20sp"
	        android:gravity="center_horizontal"
	        android:text="电子邮箱"
	        />
	    <EditText
	        android:id="@+id/edit5"
	        android:layout_width="220sp"
	        android:layout_height="wrap_content"
	        android:inputType="textEmailAddress"
	        android:singleLine="true"
	        android:textColor="@drawable/red"
	        android:textSize="20sp"
	        />
	</TableRow>
	</TableLayout>
	<Button
	    android:id="@+id/regist_button"
	    android:layout_width="match_parent"
	    android:layout_height="wrap_content"
	    android:textColor="@drawable/red"
	    android:textSize="30sp"
	    android:text="注册"
	    />
</TableLayout>


text: PLUGINLIB_EXPORT_CLASS(sm3d::filters::Frustum, sm3d::Plugin);


text:
#pragma once

#include "InstructionGraph.h"

namespace Hpipe {

/**
*/
class CppEmitter {
public:
    using VariableMap = CharGraph::VariableMap;
    using Variable = CharGraph::Variable;

    enum {
        BT_HPIPE_CB_STRING_PTR,
        BT_HPIPE_BUFFER,
        BT_BEG_END,
        BT_C_STR,
    };

    CppEmitter();

    void                  read               ( InstructionGraph *sg );

    // functions to be called after read
    void                  write_preliminaries( StreamSepMaker &ss );
    void                  write_declarations ( StreamSepMaker &ss );
    void                  write_definitions  ( StreamSepMaker &ss );

    int                   test               ( const std::vector<Lexer::TestData> &tds );
    bool                  bench              ( const std::vector<Lexer::TrainingData> &tds );

    // attributes to be modified before read()
    int                   stop_char;         ///< used if type == C_STR
    int                   buffer_type;       ///< BT_...
    bool                  trace_labels;      ///<

    // helpers for Instruction*::...
    bool                  interruptible      () const;
    bool                  need_buf           () const;
    std::string           repl_data          ( std::string code, const std::string &repl );
    void                  write_label        ( StreamSepMaker &ss, unsigned num, char letter = 'l' );
    void                  add_variable       ( const std::string &name, const std::string &type, const std::string &default_value = {} );

    unsigned              nb_cont_label;
    unsigned              size_save_glo;
    unsigned              size_save_loc;
    unsigned              nb_id_gen;

    Vec<std::string>      preliminaries;
    VariableMap           variables;
    Vec<std::string>      includes;
    Vec<std::string>      loc_vars;
    Vec<std::string>      methods;

protected:
    void                  write_parse_def    ( StreamSepMaker &ss, const std::string &hpipe_data_name = "HpipeData", const std::string &func_name = "parse", const char *additional_args = 0 );
    void                  get_ordering       ( Vec<Instruction *> &ordering, Instruction *inst );

    std::string           parse_content;
    std::string           ctor;
};

} // namespace Hpipe


text:
About tgext.pyutilservice
-------------------------

tgext.pyutilservice is a TurboGears2 extension

Installing
-------------------------------

tgext.pyutilservice can be installed from pypi::

    pip install tgext.pyutilservice

should just work for most of the users.

Enabling
-------------------------------

To enable tgext.pyutilservice put inside your application
``config/app_cfg.py`` the following::

    import tgext.pyutilservice
    tgext.pyutilservice.plugme(base_config)

or you can use ``tgext.pluggable`` when available::

    from tgext.pluggable import plug
    plug(base_config, 'tgext.pyutilservice')


text:
DROP TABLE IF EXISTS igmt_category;
CREATE TABLE igmt_category (
	id MEDIUMINT NOT NULL AUTO_INCREMENT,
	name varchar(40) NOT NULL,
	color varchar(7) NOT NULL,
	description TEXT,
	CONSTRAINT un_igmt_category UNIQUE (name),
	CONSTRAINT pk_igmt_category PRIMARY KEY (id)
) ENGINE = MYISAM;

INSERT INTO igmt_category (id, name, description, color) VALUES (1, 'Ressource', 'Element that can be gather', '#27ae60');
INSERT INTO igmt_category (id, name, description, color) VALUES (2, 'Building', 'Element that can be build', '#2c3e50');
INSERT INTO igmt_category (id, name, description, color) VALUES (3, 'Technology', 'Element that can be researched in the Laboratory and improve other element of the game', '#2980b9');
INSERT INTO igmt_category (id, name, description, color) VALUES (4, 'Event', 'Element that can occur at random time', '#c0392b');
INSERT INTO igmt_category (id, name, description, color) VALUES (5, 'Building extension', 'Element that can be build on another building', '#34495e');

DROP TABLE IF EXISTS igmt_element;
CREATE TABLE igmt_element (
	id MEDIUMINT NOT NULL AUTO_INCREMENT,
	name varchar(40) NOT NULL,
	category_id MEDIUMINT NOT NULL,
	description text,
	tag text,
	CONSTRAINT pk_igmt_element PRIMARY KEY (id),
	CONSTRAINT un_igmt_element UNIQUE (name),
	CONSTRAINT fk_igmt_category FOREIGN KEY (name) REFERENCES igmt_category(id)
) ENGINE = MYISAM;
INSERT INTO igmt_element (id, name, category_id, description, tag) VALUES (1, 'Time', 1, 'Time is money', '');
INSERT INTO igmt_element (id, name, category_id, description, tag) VALUES (2, 'Wood', 1, 'Ressource to build stuff', '');
INSERT INTO igmt_element (id, name, category_id, description, tag) VALUES (3, 'Rock', 1, 'Ressource to build stuff', '');
INSERT INTO igmt_element (id, name, category_id, description, tag) VALUES (4, 'Hut', 2, 'Increase maximum population by X', '');
INSERT INTO igmt_element (id, name, category_id, description, tag) VALUES (5, 'Cabine', 2, 'Increase maximum population by Y', '');
INSERT INTO igmt_element (id, name, category_id, description, tag) VALUES (6, 'Laboratory', 2, 'You can research some usefull tech here', '');
INSERT INTO igmt_element (id, name, category_id, description, tag) VALUES (7, 'Workshop', 2, 'You can develop some usefull tools here', '');
INSERT INTO igmt_element (id, name, category_id, description, tag) VALUES (8, 'Toolcrafting', 3, 'Use tool to chop wood, increase wood gathering efficiency by X%', '');
INSERT INTO igmt_element (id, name, category_id, description, tag) VALUES (9, 'Apple fall', 4, 'An appel has fallan from a tree', '');
INSERT INTO igmt_element (id, name, category_id, description, tag) VALUES (10, 'Population Increase', 4, 'Some wandering guy have join our settlement', '');
INSERT INTO igmt_element (id, name, category_id, description, tag) VALUES (11, 'Population management unit', 5, 'Allow to do research about population management', '');

DROP TABLE IF EXISTS igmt_link;
CREATE TABLE igmt_link (
	id MEDIUMINT NOT NULL AUTO_INCREMENT,
	from_id MEDIUMINT NULL,
	to_id MEDIUMINT NOT NULL,
	type varchar(20) NOT NULL,	/* REQUIRE or EXTEND or EVOLVE */
	conditions text,
	CONSTRAINT pk_igmt_link PRIMARY KEY (id),
	CONSTRAINT fk_igmt_link_from FOREIGN KEY (from_id) REFERENCES igmt_element(id),
	CONSTRAINT fk_igmt_link_to FOREIGN KEY (to_id) REFERENCES igmt_element(id)
) ENGINE = MYISAM;

INSERT INTO igmt_link (from_id, to_id, type, conditions) VALUES (2, 4, 'REQUIRE','Wood > 0');
INSERT INTO igmt_link (from_id, to_id, type, conditions) VALUES (2, 5, 'REQUIRE','Wood > X');
INSERT INTO igmt_link (from_id, to_id, type, conditions) VALUES (3, 5, 'REQUIRE','Stone > 0');
INSERT INTO igmt_link (from_id, to_id, type, conditions) VALUES (6, 8, 'REQUIRE','Laboratiry build');
INSERT INTO igmt_link (from_id, to_id, type, conditions) VALUES (7, 8, 'REQUIRE','Workshop build');
INSERT INTO igmt_link (from_id, to_id, type, conditions) VALUES (10, 4, 'REQUIRE','');
INSERT INTO igmt_link (from_id, to_id, type, conditions) VALUES (5, 7, 'REQUIRE','');
INSERT INTO igmt_link (from_id, to_id, type, conditions) VALUES (9, 6, 'REQUIRE','');
INSERT INTO igmt_link (from_id, to_id, type, conditions) VALUES (7, 3, 'REQUIRE','Workshop build');
INSERT INTO igmt_link (from_id, to_id, type, conditions) VALUES (11, 6, 'EXTEND','Population over X');
INSERT INTO igmt_link (from_id, to_id, type, conditions) VALUES (5, 7, 'EVOLVE','Cost some wood to evolve but offer better population housing');

DROP TABLE IF EXISTS igmt_cost_scaling;
CREATE TABLE igmt_cost_scaling (
	id MEDIUMINT NOT NULL AUTO_INCREMENT,
	name varchar(40) NOT NULL,
	formula varchar(255) NOT NULL,
	CONSTRAINT pk_igmt_cost_scaling PRIMARY KEY (id)
) ENGINE = MYISAM;

/*forumla from http://mrhen.com/blog/?cat=10*/
INSERT INTO igmt_cost_scaling(id, name, formula) VALUES (1, 'None', 'cost( n ) = base');
INSERT INTO igmt_cost_scaling(id, name, formula) VALUES (2, 'Linear', 'cost( n ) = base * n');
INSERT INTO igmt_cost_scaling(id, name, formula) VALUES (3, 'Polynomial', 'cost( n ) = base * n ^ Y');
INSERT INTO igmt_cost_scaling(id, name, formula) VALUES (4, 'Exponential', 'cost( n ) = base * Y ^ ( n - 1 )');

DROP TABLE IF EXISTS igmt_cost;
CREATE TABLE igmt_cost (
	id MEDIUMINT NOT NULL AUTO_INCREMENT,
	element_from_id MEDIUMINT NOT NULL,
	element_to_pay_id MEDIUMINT,
        scaling_id MEDIUMINT,
	base_quantity MEDIUMINT,
	CONSTRAINT pk_igmt_cost PRIMARY KEY (id),
	CONSTRAINT un_igmt_cost UNIQUE (element_from_id, element_to_pay_id),
	CONSTRAINT fk_igmt_scaling FOREIGN KEY (scaling_id) REFERENCES igmt_cost_scaling(id),
	CONSTRAINT fk_igmt_element_from FOREIGN KEY (element_from_id) REFERENCES igmt_element(id),
	CONSTRAINT fk_igmt_element_to_pay FOREIGN KEY (element_to_pay_id) REFERENCES igmt_element(id)
) ENGINE = MYISAM;

INSERT INTO igmt_cost(element_from_id, element_to_pay_id, scaling_id, base_quantity) VALUES (4, 2, 3, 10);
INSERT INTO igmt_cost(element_from_id, element_to_pay_id, scaling_id, base_quantity) VALUES (5, 2, 3, 20);
INSERT INTO igmt_cost(element_from_id, element_to_pay_id, scaling_id, base_quantity) VALUES (5, 3, 3, 10);


text:
predict-chess-elo
=================

My submission to the "Finding ELO" Kaggle challenge


text:
status: publish
tags:
- crypto
- django
- mozilla
- osl
- security
- tech
published: true
title: Adding Support for Stronger Password Hashes To Django
type: post
meta:
  aktt_tweeted: "1"
  _edit_last: "2"
  _wp_old_slug: ""
  aktt_notify_twitter: "yes"
layout: post
---
Cryptographic hash functions play an important part in application security: Usually, user passwords are hashed and stored in the database. When someone logs in, their input is hashed as well and compared to the database content. A weak hash is almost as bad as no hash at all: If someone steals (part of) your user database, they can analyze the hashed values to detect the actual password--and then use it, without the owner's knowledge, to log into your application on their behalf.

As part of a proactive web application security model, it is therefore important to stay ahead of the game attackers play and use sufficiently strong encryption to store passwords. Since cryptanalysts are spending great efforts on breaking encryption algorithms (with the help of increasingly fast and cheap computers), SHA-1 is meanwhile considered only borderline in strength. Not a good position to be in if you want to write future-proof apps.

Django (our web app framework of choice at Mozilla) does not support anything stronger than its default, SHA-1, and has, in the past, WONTFIXed attempts to increase hash strengths, citing strong backwards compatibility as the reason. As long as Django targets Python 2.4 as its greatest common denominator, this is unlikely to change. Writing a full-blown, custom authentication backend for the purpose is an option (the Mozilla Add-ons project chose to do that),  but it seemed overkill to me, given that with the exception of the hash strength, Django's built-in authentication code works just fine.

So I decided to monkey-patch their auth model at run time, to add SHA-256 support to my application (while staying backwards-compatible with older password hashes possibly existing in the database).

The code is simple, and I made an effort to keep it as uninvasive as possible, so that it can be removed easily in case Django ever does get support for stronger hashes down the road. Let me know what you think:

(Embedded from a Gist on Github).


text:
<!DOCTYPE html>

    <title>Occasional Idiot options</title>
    <link rel="icon" type="image/png" sizes="16x16" href="images/icon-16.png">

    <link rel="stylesheet" href="occasionalidiot-options.css" />

    <base href="/" />

Occasional Idiot

Browser plugin selectively hides your friends' posts when they're occasionally being idiots.

        <button class="deleteall" data-ng-click="deleteAll()">
          Delete all
        </button>

        <select data-ng-model="currentFriend"
            data-ng-options="friend as friend.name for friend in appFriends"></select>

            Name
            Trigger word

            {{word.friend}}
            {{word.word}}

        Homepage:
        http://occasionalidiot.com

        Github:
        https://github.com/omedalus/occasionalidiot

        Copyright © 2015 Mikhail Voloshin. All rights reserved.


text:
Kabam
========

Higher level framework build on top of [Kabam's kernel](https://github.com/mykabam/kabam-kernel)

[![Build Status](https://travis-ci.org/mykabam/kabam.png)](https://travis-ci.org/mykabam/kabam)

Plugins included:

- [kabam-kernel](https://github.com/mykabam/kabam-kernel) - Kernel [![Build Status](https://travis-ci.org/mykabam/kabam-kernel.png)](https://travis-ci.org/mykabam/kabam-kernel)
- [kabam-plugin-hogan](https://github.com/mykabam/kabam-plugin-hogan) - hoganJS template engine - [![Build Status](https://travis-ci.org/mykabam/kabam-plugin-hogan.png)](https://travis-ci.org/mykabam/kabam-plugin-hogan)
- [kabam-plugin-welcome](https://github.com/mykabam/kabam-plugin-welcome) - static html authorization plugin
- [kabam-plugin-my-profile](https://github.com/mykabam/kabam-plugin-my-profile) - plugin to edit my profile
- [kabam-plugin-private-message](https://raw.github.com/mykabam/kabam-plugin-private-message) [![Build Status](https://travis-ci.org/mykabam/kabam-plugin-private-message.png)](https://travis-ci.org/mykabam/kabam-plugin-private-message)
- [kabam-plugin-notify-email](https://github.com/mykabam/kabam-plugin-notify-email) - notify users by email
- [kabam-plugin-rest](https://github.com/mykabam/kabam-plugin-rest) - REST interface for mongoose collections
- [kabam-plugin-spine](https://github.com/mykabam/kabam-plugin-spine) - Redis backended task queue [![Build Status](https://travis-ci.org/mykabam/kabam-plugin-spine.png?branch=master)](https://travis-ci.org/mykabam/kabam-plugin-spine)

Example
=========

We have an examples too, [check it out here](https://github.com/mykabam/kabam/blob/master/example/example.js).

Documentation
=========

For now Kabam object is kabamKernel object with preinstalled plugins.
All kabamKernel api is exposed on it.
[Please, have a good time to read more complete documentations](http://cd.monimus.com:8080/#/api).

Plugins are activated if they find proper field in config object:

```javascript

var kabam = Kabam({
  // required fields
  'hostUrl': 'http://vvv.msk0.ru/',
  'mongoUrl': 'mongodb://localhost/kabam_dev',
  'secret': 'Long_and_hard_secret',

  // optional fields
  'redis': 'redis://kabamKernel:@localhost:6379',
  'passport': {
    //activate autorization for facebook by /auth/facebook
    'FACEBOOK_APP_ID': '--insert-facebook-app-id-here--',
    'FACEBOOK_APP_SECRET': '--insert-facebook-app-secret-here--'
  },
  // activate kabam-plugin-notify-email
  'emailConfig': 'myemail@gmail.com:1234567',
  'spine': { //activate kabam-plugin-spine
    'domains': ['urgentTasks']
  }
});

```

Exposed API
================

 `Model`. Kabam fully exposes model object of kernel application, that includes all mongoose models,
 being used by this application

 `User model`. Kabam fully exposes kernel user model, so we can create, edit and do other user related tasks programmaticly.
 Actual documentation on User's model is published here [http://cd.monimus.com:8080/#/api/User](http://cd.monimus.com:8080/#/api/User).
 The user model itself is an Active Record class, build on top of [mongooseJS](http://mongoosejs.com/) schema.
 The user model instance - User, is described here - [http://cd.monimus.com:8080/#/api/User](http://cd.monimus.com:8080/#/api/User)

  Example:

```javascript

  kabam
    .model
    .User
    .findOne({
      'username': 'vodolaz095'
    }, function(err, userFound) {
      userFound.notify('email', 'Hello!');
      usesFound.setPassword('someNewPassword', function(err) {
        userFound.notify('email', 'Your new password is "someNewPassword"');
      });
    });

  kabam
    .model
    .User
    .signUp('vodolaz095', 'vodolaz096@example.org', 'SomeLooongAndHardPassw0rd',
      function(err, userCreated) {
        userFound.notify('email', 'Hello! Verify your email please, see our previous message!');
      });

```

  `redis`. Kabam can spawn ready to work redis clients by command [kabam.createRedisClient](http://ci.monimus.com/docs/#/api/kabamKernel.createRedisClient)

```javascript

  var client = kabam.createRedisClient();
  client.set('someValue', '1', function(err) {
    if (err) throw err;
    console.log('value is set!');
  });

```

  `Event emmiter` - kabam inherites the event emmiting capabilities from kernel, and kernel inherits it from [nodejs event emmiter](http://nodejs.org/api/events.html)
  For now kabam emits events on various of situation. They are mainly documented here [http://ci.monimus.com/docs/#/api/kabamKernel.on](http://ci.monimus.com/docs/#/api/kabamKernel.on)
  For example,

```javascript

  kabam.on('http', function(log) { //basic http logger
    if (log.username) {
      console.log('User "' + log.username +
        '" made ' + log.method + ' request to page ' + log.uri +
        ' from IP of '.log.ip);
    } else {
      console.log('User "Anonimus" made ' + log.method +
        ' request to page ' + log.uri + ' from IP of '.log.ip);
    }
  });

  //event handler for user being registered
  kabamKernel.on('users:signUp', function(user) {
    if (user.email === 'freddyKrugger@example.org') {
      user.ban(function(err) {
        if (err) throw err;
      })
    } else {
      console.log('Welcome, ' + user.username + '!');
    }
  });

```

HTTP - REST API
================

Routes, related to user authorization and authentication.
POST requests can be simple html form submits or can be application/json types.
If post request have type application/json, kabam responds with application/json page.
If request is from form submit, browser is redirected with 302 code.
There is a CSRF protection present - client have to include the value of cookie of
`CSRF-TOKEN` in each POST/PUT/DELETE requests as a field of `_csrf`. When submiting the form this
value is usually printed in form and in views like this:

```html

    <input type="hidden" name="_csrf" value="[[_csrf]"/>

```

For non authorized user there is this routes present :

- `GET /auth/google` - try to autorize user via Google Account  by oAuth. If user with this email is not present in database, we create his/her account with verified gmail address, but without username and password. When user starts work with site, he\she prompted to enter them.
- `GET /auth/twitter` - try to autorize user via Twitter Account by oAuth
- `GET /auth/github` - try to autorize user via Github Account  by oAuth
- `GET /auth/facebook` - try to autorize user via Facebook Account  by oAuth
- `GET /auth/confirm/veryLongHashKey` - usually this links are recieved by email after registration.
- `GET /login` - Page to singin\signup.
- `POST /auth/login` - authorize by login and password with two mandatory parameters - `username` and `password`.
- `POST /auth/signup` - create new user account with 3 mandatory parameters - `username`,`email` and `password`.
- `POST /auth/isBusy` - route to be executed by ajax to determine, if username or email is in use. Two mandatory parameters - `username` and `email`. Response is a JSON object with information about it, like this - `{ 'username':'OK', 'email': 'OK' }`
- `POST /auth/completeProfile` - complete user profile (set username and password) when user tryes to register via Google account. Two mandatory parameters - `username` and `password`.
- `GET /auth/restoreAccount` - page where one can request email with link to page to reset his password.
- `POST /auth/restoreAccount` - send email with link to restore access to account. Mandatory paramerer - `email`.
- `POST /auth/resetPassword` - reset password for current user. Mandatory parameters are `apiKey` and `password`.

We are working on the live documentation here - [http://docs.mykabam.apiary.io/](http://docs.mykabam.apiary.io/)

Documentation disclaimer
================
Product is at state of development. But documentation are always correct.
It means that if feature is documented, it WORKS as documented.
But there can be more features, that are not documented.

Responsibility guidelines
================

Every Kabam's plugins and package has a maintainer. The maintainers will help to:

1. Maintain the package - fix and find bugs from upgrading modules included or nodejs version change
2. Respond to reported issues or bugs
3. Accept/deny pull request

The `Push` and `npm publish` privilege is the right of the `Responsible developer`. If you are interested to help us make things better here, please fork it and send us a pull request.

Responsible developer for this package is  [Anatolij Ostroumov](https://github.com/vodolaz095).

Deployment on heroku
================

We need to add custom buildpack for cairo lib - used in captcha

```shell
  $ heroku config:set BUILDPACK_URL='git://github.com/mojodna/heroku-buildpack-nodejs.git#cairo'
```

We need to install one of Redis and one MongoDB providers available at [https://addons.heroku.com](https://addons.heroku.com)

We need to manually set the hostUrl
```shell
  $ heroku config:set hostUrl='http://mykabam.herokuapp.com/'
```

We need to set the email credentials for application

```shell
  $ heroku config:set emailConfig='mywebclass@webizly.com:someVeryLongAndHardPasswordToIrritateSpammersALittleMore111111'
```

You can try this application in action - [http://mykabam.herokuapp.com/](http://mykabam.herokuapp.com/).
For now

 - You can sign up by username, email and password
 - Sign in by username and login
 - Edit profile [http://mykabam.herokuapp.com/auth/myProfile](http://mykabam.herokuapp.com/auth/myProfile)
 - See how geotagging works here [http://mykabam.herokuapp.com/](http://mykabam.herokuapp.com/). For me it shows that i  am in town of Moscow, but i am in city of Klin now... 50km from Moscow
 - Set first name, last name, skype and attach github/twitter accounts (facebook do not works for now)

License
========

Licensed under the MIT License.


text:
import Core from './core';

import './public/css/reset.css';

console.log(Core.get());


text:
#import "PFBaseState.h"

NS_ASSUME_NONNULL_BEGIN

@class PFMutableACLState;

typedef void (^PFACLStateMutationBlock)(PFMutableACLState *);

@interface PFACLState : PFBaseState<PFBaseStateSubclass, NSCopying, NSMutableCopying>

@property (nonatomic, copy, readonly) NSDictionary *permissions;
@property (nonatomic, assign, readonly, getter=isShared) BOOL shared;

///--------------------------------------
/// @name Init
///--------------------------------------

- (instancetype)init NS_DESIGNATED_INITIALIZER;
- (instancetype)initWithState:(PFACLState *)otherState NS_DESIGNATED_INITIALIZER;
- (instancetype)initWithState:(PFACLState *)otherState mutatingBlock:(PFACLStateMutationBlock)mutatingBlock;

+ (instancetype)stateWithState:(PFACLState *)otherState;
+ (instancetype)stateWithState:(PFACLState *)otherState mutatingBlock:(PFACLStateMutationBlock)mutatingBlock;

///--------------------------------------
/// @name Mutating
///--------------------------------------

- (instancetype)copyByMutatingWithBlock:(PFACLStateMutationBlock)mutatingBlock NS_RETURNS_RETAINED;

@end

NS_ASSUME_NONNULL_END


text:
package deprecated.org.crf.crf.filters;

import java.io.Serializable;

/**
 * A filter determines whether it is known a priori that the feature value is zero
 * for a given input. "Input" is the sequence of tokens, the token-index, its tag, and the tag of the preceding token.
 *

 * The CRF formula e^{weight-vector*feature-vector} might be quite expensive in run-time complexity notion. However,
 * in most cases most of the mostlikelytreefromlist return zero for the given input. Thus, there is no need to sum over all the mostlikelytreefromlist,
 * but only over those which might return a non-zero value.
 *

 * Concretely, Assume we have a {@link CrfFilteredFeature} and a {@link Filter}: if the filter {@link #equals(Object)
 * to {@link CrfFilteredFeature#getFilter()}, then the feature might return a non-zero value. Otherwise, it is
 * known for sure that it returns zero.
 *

 * The usage of filters is to build a map from {@link Filter } to a set of {@link CrfFilteredFeature}s, and for each input
 * create filters and use them to retrieve the set of relevant mostlikelytreefromlist from the map.
 *
 * @see CrfFilteredFeature
 * @see FilterFactory
 * @see CrfUtilities#getActiveFeatureIndexes(CrfFeaturesAndFilters, Object[], int, Object, Object)
 *
 * @author Asher Stern
 * Date: November 2014
 *
 * @param <K>
 * @param <G>
 */
public abstract class Filter<K,G> implements Serializable
{
	private static final long serialVersionUID = 5563671313834518710L;

	public abstract int hashCode();
	public abstract boolean equals(Object obj);
}


text:
@interface EMEmojiableBtn()
@property (nonatomic,strong) EMEmojiableBtnConfig *config;
@property (strong,nonatomic) UIView *selectorBgView;
@property (strong,nonatomic) UIView *optionsView;
@property (strong,nonatomic)  EMEmojiableInformationView *informationView;
@property (strong,nonatomic) UITapGestureRecognizer *singleTapGesture;
@property (strong,nonatomic) UILongPressGestureRecognizer *longPressGesture;
@property (assign,nonatomic) BOOL active;
@property (assign,nonatomic) MenuDirection menuDirection;
@property (assign,nonatomic) CGPoint origin;
@property (assign,nonatomic) CGRect optionsViewOriginalRect;
@property (assign,nonatomic) int selectedItem;
@end

@implementation EMEmojiableBtn{
    NSArray *_dataset;
}
@synthesize selectorBgView;
@synthesize optionsView;
@synthesize longPressGesture;
@synthesize singleTapGesture;
@synthesize active;
@synthesize menuDirection;
@synthesize origin;
@synthesize informationView;
@synthesize selectedItem;
@synthesize optionsViewOriginalRect;
#pragma mark - Init

- (instancetype)initWithFrame:(CGRect)frame{
    if(self = [super initWithFrame:frame]){
        [self privateInit];
    }
    return self;
}

- (instancetype)initWithFrame:(CGRect)frame withConfig:(EMEmojiableBtnConfig*)conf{
    if(self = [super initWithFrame:frame]){
        self.config = conf;
        [self privateInit];
    }
    return self;
}

- (void)dealloc{
    self.delegate = nil;
    [self removeGestureRecognizer:singleTapGesture];
    [self removeGestureRecognizer:longPressGesture];
}

- (void)privateInit{
    active = NO;
    singleTapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(singleTap)];
    longPressGesture = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longTap:)];
    //longPressGesture.cancelsTouchesInView = NO;
    singleTapGesture.cancelsTouchesInView = NO;
    [self addGestureRecognizer:singleTapGesture];
    [self addGestureRecognizer:longPressGesture];

    self.layer.masksToBounds = NO;
}

- (EMEmojiableBtnConfig*)config{
    if(_config == nil){
        return self.config = [[EMEmojiableBtnConfig alloc] init];
    }
    return _config;
}

#pragma mark - UI
- (void)activate{
    if(active){
        return;
    }
    if(_dataset == nil){
        [NSException raise:@"Invalid _dataset value" format:@"_dataset can't be nil"];
        return;
    }

    selectedItem = -1;
    active = YES;

    CGRect selectorViewFrame = [UIScreen mainScreen].bounds;
    origin = [self.superview convertPoint:self.frame.origin toView:nil];
    menuDirection = [self getMenuDirection];

    if (!CGPointEqualToPoint(origin,self.frame.origin)) {
        selectorViewFrame.origin.x -= origin.x;
        selectorViewFrame.origin.y -= origin.y;
    }

    selectorBgView = [[UIView alloc] initWithFrame:selectorViewFrame];
    selectorBgView.backgroundColor = self.config.backgroundColor;
    [self.superview addSubview:selectorBgView];

    CGFloat buttonWidth = ((CGFloat)(_dataset.count + 1) * self.config.spacing) +(self.config.size*(CGFloat)_dataset.count);
    CGFloat buttonHeight = self.config.size+(2*self.config.spacing);
    CGSize sizeBtn = CGSizeMake(buttonWidth,buttonHeight);

    CGRect optionsViewFrame = [self adjustFrameIfNeeded:CGRectMake(origin.x, origin.y - sizeBtn.height, sizeBtn.width, sizeBtn.height) leftMenuXOrigin:(origin.x + self.frame.size.width - sizeBtn.width) downMenuYOrigin:0.0];

    optionsView = [[UIView alloc] initWithFrame:optionsViewFrame];
    optionsView.alpha               = self.config.optionsViewInitialAlpha;
    optionsView.layer.cornerRadius  = optionsView.frame.size.height/2.0;
    optionsView.backgroundColor     = self.config.optionsViewBackgroundColor;
    optionsView.layer.shadowColor   = self.config.optionsViewShadowColor.CGColor;
    optionsView.layer.shadowOffset  = self.config.optionsViewShadowOffset;
    optionsView.layer.shadowOpacity = self.config.optionsViewShadowOpacity;

    [selectorBgView addSubview:optionsView];

    [UIView animateWithDuration:0.2 animations:^{
        CGRect frame = self.optionsView.frame;
        frame.origin.y = self.origin.y - (self.config.s_options_selector + sizeBtn.height);
        self.optionsView.frame = optionsViewOriginalRect = frame;
        self.optionsView.alpha = 1.0;
    }];

    for (int i = 0; i<_dataset.count;++i){
        EMEmojiableOption *option = [_dataset objectAtIndex:i];
        CGRect frame = CGRectMake(((CGFloat)(i+1)*self.config.spacing)+(self.config.size*(CGFloat)i),sizeBtn.height*1.2,10,10);
        CGPoint center = CGPointMake(((CGFloat)(i+1)*self.config.spacing)+(self.config.size*(CGFloat)i)+self.config.size/2.0,self.config.spacing+self.config.size/2.0);

        UIImageView *optionImageView = [[UIImageView alloc] initWithFrame: [self adjustFrameIfNeeded:frame leftMenuXOrigin:(optionsView.frame.size.width - frame.origin.x) downMenuYOrigin:0.0]];
        CGPoint centerPoint = [self adjustPointIfNeeded:center leftMenuX:(optionsView.frame.size.width - center.x) downMenuY:0.0];

        optionImageView.image = [UIImage imageNamed:option.imageName];
        optionImageView.alpha = 0.6;
        [optionsView addSubview:optionImageView];

        [UIView animateWithDuration:0.2 delay:0.05*(double)i options:UIViewAnimationOptionCurveEaseInOut animations:^{
            CGRect optionImageViewFrame     = optionImageView.frame;
            optionImageViewFrame.origin.y   = self.config.spacing;
            optionImageViewFrame.size       = CGSizeMake(self.config.size, self.config.size);
            optionImageView.frame           = optionImageViewFrame;
            optionImageView.center          = centerPoint;
            optionImageView.alpha           = 1.0;
        } completion:nil];
    }

    informationView = [[EMEmojiableInformationView alloc] initWithFrame:CGRectMake(0, origin.y, selectorViewFrame.size.width, self.frame.size.height) withConfig:self.config];
    informationView.backgroundColor = self.config.informationViewBackgroundColor;
    [selectorBgView addSubview:informationView];
}

- (void)deActivate:(int)optionIndex{
    if (optionIndex < 0){
        if(self.delegate && [self.delegate respondsToSelector:@selector(EMEmojiableBtnCanceledAction:)]){
            [self.delegate EMEmojiableBtnCanceledAction:self];
        }
    }else{
        if(self.delegate && [self.delegate respondsToSelector:@selector(EMEmojiableBtn:selectedOption:)]){
            [self.delegate EMEmojiableBtn:self selectedOption:selectedItem];
        }
    }

    [optionsView.subviews enumerateObjectsUsingBlock:^(UIView *option, NSUInteger idx, BOOL *stop) {
        [UIView animateWithDuration:0.2 delay:0.05*(double)idx options:UIViewAnimationOptionCurveEaseInOut animations:^{
            CGPoint center;
            CGRect optionFrame = option.frame;
            optionFrame.size = CGSizeMake(10.0,10.0);
            informationView.alpha = 0;
            option.alpha    = 0.3;
            option.frame    = optionFrame;
            if(optionIndex == idx){
                center = CGPointMake(((CGFloat)idx+1.0*self.config.spacing)+(self.config.size*idx)+self.config.size/2,-self.optionsView.frame.size.height+self.config.size/2.0);
                option.center = [self adjustPointIfNeeded:center leftMenuX:(optionsView.frame.size.width - center.x) downMenuY:0.0];

            }else{
                center = CGPointMake(((CGFloat)idx+1.0*self.config.spacing)+(self.config.size*(CGFloat)idx)+self.config.size/2.0, self.optionsView.frame.size.height+self.config.size/2.0);
                option.center = [self adjustPointIfNeeded:center leftMenuX:(optionsView.frame.size.width - center.x) downMenuY:0.0];
            }

        } completion:^(BOOL finished) {
            if (finished && idx == (_dataset.count/2)){
                [UIView animateWithDuration:0.1 animations:^{
                    CGRect optionsViewFrame = optionsView.frame;
                    optionsViewFrame.origin.y = origin.y - (self.config.size+(2*self.config.spacing));
                    optionsView.alpha   = 0;
                    optionsView.frame = optionsViewFrame;
                } completion:^(BOOL finished) {
                    active = false;
                    [selectorBgView removeFromSuperview];
                }];
            }
        }];
    }];
}

- (void)selectIndex:(int)index{
    if (index < 0 || index > _dataset.count){
        return;
    }

    selectedItem = index;
    [informationView activateInfo:NO];

    [UIView animateWithDuration:0.3 animations:^{
        CGFloat buttonWidth = (((CGFloat)_dataset.count-1*self.config.spacing)+(self.config.minSize*(CGFloat)_dataset.count-1)+self.config.maxSize);
        CGFloat buttonHeight = self.config.minSize+(2*self.config.spacing);
        CGSize sizeBtn = CGSizeMake(buttonWidth,buttonHeight);

        optionsView.frame = [self adjustFrameIfNeeded:CGRectMake(self.origin.x, self.origin.y - (self.config.s_options_selector+sizeBtn.height), sizeBtn.width, sizeBtn.height) leftMenuXOrigin:(self.origin.x + self.frame.size.width - sizeBtn.width) downMenuYOrigin:0.0];
        optionsView.layer.cornerRadius = sizeBtn.height/2;

        __block CGFloat last = index != 0 ? self.config.spacing : 0;

        [optionsView.subviews enumerateObjectsUsingBlock:^(UIView *view, NSUInteger idx, BOOL *stop) {
            CGRect frame;
            CGPoint center;
            if(idx == index-1){
                frame           = CGRectMake(last,self.config.spacing,self.config.minSize,self.config.minSize);
                view.frame      = [self adjustFrameIfNeeded:frame leftMenuXOrigin:(optionsView.frame.size.width - self.config.minSize - last) downMenuYOrigin:0.0];
                center          = CGPointMake(view.center.x, (self.config.minSize/2) + self.config.spacing);
                view.center     = [self adjustPointIfNeeded:center leftMenuX:view.center.x downMenuY:0.0];
                last            += self.config.minSize;

            }else if(idx == index){
                frame           = CGRectMake(last, -(self.config.maxSize/2), self.config.maxSize, self.config.maxSize);
                view.frame      = [self adjustFrameIfNeeded:frame leftMenuXOrigin:(optionsView.frame.size.width - self.config.maxSize - last) downMenuYOrigin:0.0];
                last            += self.config.maxSize;
            }else {
                frame          = CGRectMake(last,self.config.spacing,self.config.minSize,self.config.minSize);
                view.frame     = [self adjustFrameIfNeeded:frame leftMenuXOrigin:(optionsView.frame.size.width - self.config.minSize - last) downMenuYOrigin:0.0];
                center         = CGPointMake(view.center.x, (self.config.minSize/2) + self.config.spacing);
                view.center    = [self adjustPointIfNeeded:center leftMenuX:view.center.x downMenuY:0.0];
                last            += self.config.minSize + self.config.spacing;
            }

        }];
    }];
}

- (CGRect)adjustFrameIfNeeded: (CGRect)frame leftMenuXOrigin:(CGFloat)x downMenuYOrigin:(CGFloat)y{
    CGRect adjustedFrame;
    if (menuDirection == MenuDirectionUpRight){
        adjustedFrame = frame;
    } else if (menuDirection == MenuDirectionUpLeft) {
        adjustedFrame = CGRectMake(x, frame.origin.y, frame.size.width, frame.size.height);
    } else if (menuDirection == MenuDirectionDownRight) {
        adjustedFrame = CGRectMake(frame.origin.x, y, frame.size.width, frame.size.height);
    } else if (menuDirection == MenuDirectionDownLeft) {
        adjustedFrame = CGRectMake(x, y, frame.size.width, frame.size.height);
    }

    return adjustedFrame;
}

- (CGPoint)adjustPointIfNeeded: (CGPoint)point leftMenuX:(CGFloat)x downMenuY:(CGFloat)y{
    CGPoint adjustedPoint;
    if (menuDirection == MenuDirectionUpRight){
        adjustedPoint = point;
    } else if (menuDirection == MenuDirectionUpLeft) {
        adjustedPoint = CGPointMake(x, point.y);
    } else if (menuDirection == MenuDirectionDownRight) {
        adjustedPoint = CGPointMake(point.x, y);
    } else if (menuDirection == MenuDirectionDownLeft) {
        adjustedPoint = CGPointMake(x, y);
    }

    return adjustedPoint;
}

- (MenuDirection)getMenuDirection{
    CGFloat center = self.superview.center.x;
    CGFloat top = 0;

    if (origin.x <= center && origin.y > top) {
        return MenuDirectionUpRight;
    }
    else if (origin.x > center && origin.y > top) {
        return MenuDirectionUpLeft;
    }
    else if (origin.x <= center && origin.y <= top) {
        return MenuDirectionDownRight;
    }
    else {
        return MenuDirectionDownLeft;
    }
}

- (void)looseFocus{
    selectedItem = -1;
    [informationView activateInfo:YES];
    [UIView animateWithDuration:0.3 animations:^{
        CGFloat buttonWidth = (((CGFloat)_dataset.count+1*self.config.spacing)+(self.config.size*(CGFloat)_dataset.count));
        CGFloat buttonHeight = self.config.size+(2.0*self.config.spacing);
        CGSize sizeBtn = CGSizeMake(buttonWidth,buttonHeight);
        optionsView.frame = optionsViewOriginalRect;
        optionsView.layer.cornerRadius = sizeBtn.height/2.0;

        [optionsView.subviews enumerateObjectsUsingBlock:^(UIView *view, NSUInteger idx, BOOL *stop) {
            CGRect frame = CGRectMake(((CGFloat)(idx+1)*self.config.spacing)+(self.config.size*(CGFloat)idx),self.config.spacing,self.config.size,self.config.size);
            view.frame = [self adjustFrameIfNeeded:frame leftMenuXOrigin:(optionsView.frame.size.width - self.config.size - frame.origin.x) downMenuYOrigin:0.0];
        }];
    }];
}

#pragma mark - Gestures
- (void)singleTap{
    if(self.delegate && [self.delegate respondsToSelector:@selector(EMEmojiableBtnSingleTap:)]){
        [self.delegate EMEmojiableBtnSingleTap:self];
    }
}

- (void)longTap:(UIGestureRecognizer*)gesture{
    if (gesture.state == UIGestureRecognizerStateBegan){
        [self activate];
    } else if (gesture.state == UIGestureRecognizerStateChanged){
        CGPoint point = [gesture locationInView:selectorBgView];

        CGFloat t = optionsView.frame.size.width/(CGFloat)_dataset.count;
        if (point.y < (CGRectGetMinY(optionsView.frame) - 50) || point.y > (CGRectGetMaxY(informationView.frame) + 30)){
            [self looseFocus];
        }else{
            if ((menuDirection == MenuDirectionUpRight) && ((point.x-origin.x) > 0 && point.x < (CGRectGetMaxX(optionsView.frame)-30))) {
                int selected = round((point.x-origin.x)/t);
                [self selectIndex:selected];
            }else if ((menuDirection == MenuDirectionUpLeft) && ((origin.x + self.frame.size.width - point.x) > 0 && point.x > (CGRectGetMinX(optionsView.frame) + 30))) {
                int selected = round((origin.x + self.frame.size.width - point.x)/t);
                [self selectIndex:selected];
            }else{
                [self looseFocus];
            }
        }
    }
    else if (gesture.state == UIGestureRecognizerStateEnded){
        CGPoint point = [gesture locationInView:selectorBgView];
        if (((menuDirection == MenuDirectionUpRight) && (point.x > 0 && point.x < CGRectGetMaxX(optionsView.frame))) ||
            ((menuDirection == MenuDirectionUpLeft) && (point.x < selectorBgView.frame.size.width && point.x > CGRectGetMinX(optionsView.frame)))) {
            [self deActivate:selectedItem];
        }else{
            [self deActivate:-1];
        }
    }
}

@end


text:
ReadableExpressions provides extension methods and a
[Debugger Visualizer](https://marketplace.visualstudio.com/items?itemName=vs-publisher-1232914.ReadableExpressionsVisualizers)
for readable, source-code versions of
[Expression Trees](https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/concepts/expression-trees),
as well as reflection objects like `Type`, `FieldInfo`, `PropertyInfo`, etc.

## Debugger Visualizer

The Debugger Visualizer installer can be downloaded from
[Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=vs-publisher-1232914.ReadableExpressionsVisualizers).

The visualizer has both Light and Dark themes:

[![Visualizer themes](/docs/src/assets/images/Themes.gif)]

...and output can be customised using various options:

[![Visualizer options](/docs/src/assets/images/Options.gif)]

## ASP.NET Core 5 Known Issue

.NET 5 had [a breaking change](https://github.com/dotnet/runtime/issues/29976), which disables `BinaryFormatter` serialization by default.
This has caused issues with the ReadableExpressions visualizers (and [elsewhere](https://github.com/nhibernate/nhibernate-core/issues/2603))
when debugging ASP.NET Core apps as the VS debugger [uses](https://wrightfully.com/writing-a-readonly-debugger-visualizer) `BinaryFormatter`
to serialize objects before sending them to the visualizer.

[The solution](https://developercommunity2.visualstudio.com/t/visual-studio-debugger-visualizers-and-binaryforma/1278642) is to enable the
`BinaryFormatter` in Debug only by adding the following to your ASP.NET Core csproj:

```xml
<PropertyGroup>
  <TargetFramework>net5.0</TargetFramework>
  <EnableUnsafeBinaryFormatterSerialization Condition=" '$(Configuration)' == 'Debug' ">
    true
  </EnableUnsafeBinaryFormatterSerialization>
</PropertyGroup>
```

## Extension Methods

[The extension methods](https://readableexpressions.readthedocs.io/extension-methods) are available
[on NuGet](https://www.nuget.org/packages/AgileObjects.ReadableExpressions),
and target .NET 3.5+ and [.NETStandard 1.0](https://dotnet.microsoft.com/platform/dotnet-standard)+:

```shell
PM> Install-Package AgileObjects.ReadableExpressions
```
[![NuGet version](https://badge.fury.io/nu/AgileObjects.ReadableExpressions.svg)](https://badge.fury.io/nu/AgileObjects.ReadableExpressions)

To translate an Expression, use:

```csharp
using AgileObjects.ReadableExpressions;

string readable = myExpression.ToReadableString();
```

...this also works on [DynamicLanguageRuntime](https://www.nuget.org/packages/DynamicLanguageRuntime) expressions.

All code is licensed with the [MIT licence](LICENCE.md). Check out
[the documentation](https://readableexpressions.readthedocs.io) for more!