text:
 	/**
 *
 */
package controller;

import view.EmployeeRegisterView;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import dao.EmployeeDAO;
import model.Address;

import model.Employee;
import util.GraphicsUtil;
import util.SystemConstUtil;

/**
 * @author diogodantas
 *
 */
public class EmployeeRegisterControl {

	private EmployeeRegisterView employeeRegisterView;
	private Events events;
	private EmployeeDAO employeeDAO;
	private Employee employee;
	private short call;

	public EmployeeRegisterControl(EmployeeRegisterView employeeRegisterView) {
		this.employeeRegisterView = employeeRegisterView;
		this.events = new Events();
		this.employeeDAO = new EmployeeDAO();
		this.employee = null;
		this.call = SystemConstUtil.INSERT;

		//add listeners
		employeeRegisterView.getBtnSim().addActionListener(events);
		employeeRegisterView.getBtnNao().addActionListener(events);
		employeeRegisterView.getBtnCadastrar().addActionListener(events);
		employeeRegisterView.getBtnLimpar().addActionListener(events);
		employeeRegisterView.getLblImageButtonVoltar().addMouseListener(events);
		employeeRegisterView.getBtnOK().addActionListener(events);
	}

	public EmployeeRegisterControl(EmployeeRegisterView employeeRegisterView, Employee employee) {
		this(employeeRegisterView);
		this.call = SystemConstUtil.UPDATE;
		this.employee = employee;
		employeeRegisterView.getBtnCadastrar().setText("Atualizar");
		employeeRegisterView.getBtnLimpar().setText("Deletar");
		employeeRegisterView.getLblTitleEmployee().setText("Atualização de Funcionários");
		employeeRegisterView.getLblTitleEmployee().setFont(new Font("DejaVu Sans", Font.PLAIN, 44));

		employeeRegisterView.getTxtNome().setText(employee.getName());
		employeeRegisterView.getTxtEmail().setText(employee.getEmail());
		employeeRegisterView.getTxtTelefone().setText(employee.getPhone());
		employeeRegisterView.getTxtDataNasc().setText(employee.getDateOfBirth());
		employeeRegisterView.getTxtAgencia().setText(employee.getAgency());
		employeeRegisterView.getTxtConta().setText(employee.getCount());
		employeeRegisterView.getTxtCPF().setText(employee.getCpf());
		employeeRegisterView.getComboTipoFunc().setSelectedItem(employee.getType());
		employeeRegisterView.getTxtLogradouro().setText(employee.getAddress().getStreet());
		employeeRegisterView.getTxtNumero().setText(String.valueOf(employee.getAddress().getNumber()));
		employeeRegisterView.getTxtBairro().setText(employee.getAddress().getDistrict());
		employeeRegisterView.getTxtComplemento().setText(employee.getAddress().getComplement());
		employeeRegisterView.getComboUF().setSelectedIndex(0);
		employeeRegisterView.getTxtCidade().setText(employee.getAddress().getCity());
		employeeRegisterView.getTxtLogin().setText(employee.getUsername());
		employeeRegisterView.getPwdSenha().setText(employee.getPassword());
	}

	private void cleanFields(){
		employeeRegisterView.getTxtNome().setText("");
		employeeRegisterView.getTxtEmail().setText("");
		employeeRegisterView.getTxtTelefone().setText("");
		employeeRegisterView.getTxtDataNasc().setText("");
		employeeRegisterView.getTxtAgencia().setText("");
		employeeRegisterView.getTxtConta().setText("");
		employeeRegisterView.getTxtCPF().setText("");
		employeeRegisterView.getComboTipoFunc().setSelectedIndex(0);
		employeeRegisterView.getTxtLogradouro().setText("");
		employeeRegisterView.getTxtNumero().setText("");
		employeeRegisterView.getTxtBairro().setText("");
		employeeRegisterView.getTxtComplemento().setText("");
		employeeRegisterView.getComboUF().setSelectedIndex(0);
		employeeRegisterView.getTxtCidade().setText("");
		employeeRegisterView.getTxtLogin().setText("");
		employeeRegisterView.getPwdSenha().setText("");
	}

	private boolean checkFields(){

		if(employeeRegisterView.getTxtNome().getText().isEmpty() ||
		   employeeRegisterView.getTxtDataNasc().getText().isEmpty() ||
		   employeeRegisterView.getTxtTelefone().getText().isEmpty() ||
		   employeeRegisterView.getTxtCPF().getText().isEmpty() ||
		   employeeRegisterView.getTxtLogin().getText().isEmpty()){

			return false;
		}

		return true;
	}

	private void inflate(){
		Address address = new Address(employeeRegisterView.getTxtComplemento().getText(),
				employeeRegisterView.getTxtCidade().getText(), employeeRegisterView.getTxtCidade().getText(),
				employeeRegisterView.getTxtBairro().getText(),
				Integer.parseInt(employeeRegisterView.getTxtNumero().getText()),
				employeeRegisterView.getComboUF().getSelectedItem().toString());

		employee.setName(employeeRegisterView.getTxtNome().getText());
		employee.setEmail(employeeRegisterView.getTxtEmail().getText());
		employee.setPhone(employeeRegisterView.getTxtTelefone().getText());
		employee.setDateOfBirth(employeeRegisterView.getTxtDataNasc().getText());
		employee.setAgency(employeeRegisterView.getTxtAgencia().getText());
		employee.setCount(employeeRegisterView.getTxtConta().getText());
		employee.setCpf(employeeRegisterView.getTxtCPF().getText());
		employee.setType(employeeRegisterView.getComboTipoFunc().getSelectedItem().toString());
		employee.setAddress(address);
		employee.setUsername(employeeRegisterView.getTxtLogin().getText());
		employee.setPassword(String.valueOf(employeeRegisterView.getPwdSenha().getPassword()));

	}

	private void insert(){
		employee = new Employee();
		inflate();

		if(checkFields()){
			employeeDAO.add(employee);
			showPanelDialog();
		} else
			employeeRegisterView.getLblMessageError().setVisible(true);
	}

	private void update() {
		inflate();

		if(checkFields()){
			showPanelDialog();
			employeeDAO.update(employee);
		} else
			employeeRegisterView.getLblMessageError().setVisible(true);
	}

	private void showPanelDialog(){
		employeeRegisterView.getPanelDialog().setVisible(true);

		employeeRegisterView.getTxtNome().setEnabled(false);
		employeeRegisterView.getTxtEmail().setEnabled(false);
		employeeRegisterView.getTxtTelefone().setEnabled(false);
		employeeRegisterView.getTxtDataNasc().setEnabled(false);
		employeeRegisterView.getTxtAgencia().setEnabled(false);
		employeeRegisterView.getTxtConta().setEnabled(false);
		employeeRegisterView.getTxtCPF().setEnabled(false);
		employeeRegisterView.getComboTipoFunc().setEnabled(false);
		employeeRegisterView.getTxtLogradouro().setEnabled(false);
		employeeRegisterView.getTxtNumero().setEnabled(false);
		employeeRegisterView.getTxtBairro().setEnabled(false);
		employeeRegisterView.getTxtComplemento().setEnabled(false);
		employeeRegisterView.getComboUF().setEnabled(false);
		employeeRegisterView.getTxtCidade().setEnabled(false);
		employeeRegisterView.getTxtLogin().setEnabled(false);
		employeeRegisterView.getPwdSenha().setEnabled(false);

		employeeRegisterView.getBtnCadastrar().setEnabled(false);
		employeeRegisterView.getBtnLimpar().setEnabled(false);
	}

	private void disposePanelDialog(){
		employeeRegisterView.getPanelDialog().setVisible(false);
		employeeRegisterView.getTxtNome().requestFocus();

		employeeRegisterView.getTxtNome().setEnabled(true);
		employeeRegisterView.getTxtEmail().setEnabled(true);
		employeeRegisterView.getTxtTelefone().setEnabled(true);
		employeeRegisterView.getTxtDataNasc().setEnabled(true);
		employeeRegisterView.getTxtAgencia().setEnabled(true);
		employeeRegisterView.getTxtConta().setEnabled(true);
		employeeRegisterView.getTxtCPF().setEnabled(true);
		employeeRegisterView.getComboTipoFunc().setEnabled(true);
		employeeRegisterView.getTxtLogradouro().setEnabled(true);
		employeeRegisterView.getTxtNumero().setEnabled(true);
		employeeRegisterView.getTxtBairro().setEnabled(true);
		employeeRegisterView.getTxtComplemento().setEnabled(true);
		employeeRegisterView.getComboUF().setEnabled(true);
		employeeRegisterView.getTxtCidade().setEnabled(true);
		employeeRegisterView.getTxtLogin().setEnabled(true);
		employeeRegisterView.getPwdSenha().setEnabled(true);

		employeeRegisterView.getBtnCadastrar().setEnabled(true);
		employeeRegisterView.getBtnLimpar().setEnabled(true);
		cleanFields();
	}

	//inner class
	private class Events implements ActionListener, MouseListener{

		@Override
		public void actionPerformed(ActionEvent e) {
			if(e.getSource() == employeeRegisterView.getBtnCadastrar()){
				if(call == SystemConstUtil.INSERT)
					insert();
				else if(call == SystemConstUtil.UPDATE)
					update();

			} else if(e.getSource() == employeeRegisterView.getBtnOK()){
				disposePanelDialog();

				if(call == SystemConstUtil.UPDATE)
					employeeRegisterView.dispose();
			}
			else if (e.getSource() == employeeRegisterView.getBtnLimpar()){
				if(call == SystemConstUtil.INSERT)
					cleanFields();
				else if(call == SystemConstUtil.UPDATE){
					employeeRegisterView.getBtnOK().setVisible(false);
					employeeRegisterView.getBtnSim().setVisible(true);
					employeeRegisterView.getBtnNao().setVisible(true);

					employeeRegisterView.getLblMessagedialog().setText("<html>Deseja realmente<br>excluir registro ?<html>");
					employeeRegisterView.getLblIconMessage().setIcon(GraphicsUtil.adjustImage("/drawable/warning.png",
							employeeRegisterView.getLblIconMessage().getSize()));
					showPanelDialog();
				}
			}else if(e.getSource() == employeeRegisterView.getBtnSim()){
				employeeDAO.delete(employee);
				employeeRegisterView.dispose();

			} else if(e.getSource() == employeeRegisterView.getBtnNao()){
				employeeRegisterView.dispose();
			}

		}

		@Override
		public void mouseClicked(MouseEvent e) {
			if(e.getSource() == employeeRegisterView.getLblImageButtonVoltar()){
				employeeRegisterView.dispose();
				employeeDAO.disconnect();
			}

		}

		@Override
		public void mousePressed(MouseEvent e) {/* unimplemented method */ }

		@Override
		public void mouseReleased(MouseEvent e) {/* unimplemented method */ }

		@Override
		public void mouseEntered(MouseEvent e) {/* unimplemented method */ }

		@Override
		public void mouseExited(MouseEvent e) {/* unimplemented method */ }

	}
}


text:
SYNONYM

#### According to
Index Fungorum

#### Published in
null

#### Original name
Phoma aposphaerioides Briard & Har.

### Remarks
null

redpajama_set_name: RedPajamaGithub


text:
package com.distantfuture.videos.youtube;

import android.app.Activity;
import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Parcel;
import android.os.Parcelable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.BounceInterpolator;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.SeekBar;
import android.widget.TextView;

import com.distantfuture.videos.R;
import com.distantfuture.videos.imageutils.ToolbarIcons;
import com.distantfuture.videos.misc.AppUtils;
import com.distantfuture.videos.misc.Utils;

public class VideoPlayer {
  private final int mAnimationDuration = 300;
  private final int mIconSize = 32;
  private View mVideoBox;
  private Context mContext;
  private VideoPlayerFragment mVideoFragment;
  private VideoPlayerStateListener mListener;
  private ImageView mMuteButton;
  private TextView mSeekFlashTextView;
  private TextView mTimeRemainingTextView;
  private View mTopBar;

  public VideoPlayer(Activity activity, int fragmentContainerResID, VideoPlayerStateListener l) {
    super();

    mListener = l;
    mContext = activity.getApplicationContext();

    // install video fragment
    // will already exist if restoring Activity
    mVideoFragment = (VideoPlayerFragment) activity.getFragmentManager()
        .findFragmentById(fragmentContainerResID);

    // hide top bar when going fullscreen
    mTopBar = activity.findViewById(R.id.top_bar);
    mVideoFragment.setVideoFragmentListener(new VideoPlayerFragment.VideoFragmentListener() {

      @Override
      public void onFullScreen(boolean fullscreen) {
        mTopBar.setVisibility(fullscreen ? View.GONE : View.VISIBLE);
      }

      @Override
      public void playerInitialized() {
        if (AppUtils.instance(mContext).alwaysPlayFullscreen())
          mVideoFragment.setFullscreen(true);

        // we avoid showing the view until after fullscreen is set after the player is setup
        mVideoBox.setVisibility(View.VISIBLE);
      }
    });

    mVideoBox = activity.findViewById(R.id.video_player_box);

    setupToolbar();
  }

  public void open(final PlayerParams params) {
    if (visible())
      playerShown(params);
    else {
      Utils.vibrate(mContext);

      if (AppUtils.instance(mContext).alwaysPlayFullscreen()) {
        playerShown(params);
      } else {
        // update mute button since it could still be in mute mode
        updateMuteButton();

        boolean animate = Utils.isPortrait(mContext);
        if (animate) {
          // Initially translate off the screen so that it can be animated in from below.
          mVideoBox.setTranslationY(-mVideoBox.getHeight());
          mVideoBox.setAlpha(0f);

          mVideoBox.setVisibility(View.VISIBLE);

          mVideoBox.animate()
              .translationY(0)
              .alpha(1f)
              .setInterpolator(new AccelerateDecelerateInterpolator())
              .setDuration(mAnimationDuration)
              .withEndAction(new Runnable() {
                @Override
                public void run() {
                  playerShown(params);
                }
              });
        } else {
          mVideoBox.setVisibility(View.VISIBLE);

          playerShown(params);
        }
      }
    }
  }

  public PlayerParams playerParams() {
    return mVideoFragment.playerParams();
  }

  public void close() {
    if (visible()) {
      Utils.vibrate(mContext);

      mVideoFragment.closingPlayer();

      boolean animate = Utils.isPortrait(mContext);

      if (animate) {
        mVideoBox.animate()
            .translationYBy(-mVideoBox.getHeight())
            .alpha(.3f)
            .setInterpolator(new AccelerateInterpolator())
            .setDuration(animate ? mAnimationDuration : 0)
            .withEndAction(new Runnable() {
              @Override
              public void run() {
                playerClosed();
              }
            });
      } else
        playerClosed();
    }
  }

  public String title() {
    return mVideoFragment.getTitle();
  }

  public String videoId() {
    return mVideoFragment.getVideoId();
  }

  public boolean visible() {
    return (mVideoBox.getVisibility() == View.VISIBLE);
  }

  public void toggleMute() {
    mVideoFragment.mute(!mVideoFragment.isMute());

    updateMuteButton();
  }

  public void toggleFullscreen() {
    mVideoFragment.setFullscreen(true);
  }

  public void skip(int seconds) {
    mVideoFragment.seekRelativeSeconds(seconds);
  }

  private void updateMuteButton() {
    if (mVideoFragment.isMute())
      mMuteButton.setImageDrawable(ToolbarIcons.icon(mContext, ToolbarIcons.IconID.SOUND, Color.RED, mIconSize));
    else
      mMuteButton.setImageDrawable(ToolbarIcons.icon(mContext, ToolbarIcons.IconID.SOUND, Color.WHITE, mIconSize));
  }

  private void playerShown(PlayerParams playerParams) {
    // action bar menu needs to update
    Activity host = (Activity) mVideoBox.getContext();
    if (host != null)
      host.invalidateOptionsMenu();

    mVideoFragment.setVideo(playerParams);

    // actionbar subtitle needs a refresh when new video starts playing, so it's not just open/close events
    // that need state changed messages

    if (mListener != null)
      mListener.stateChanged();
  }

  // ------------------------------------------------------------------------------------------------
  // private

  private void playerClosed() {
    // action bar menu needs to update
    Activity host = (Activity) mVideoBox.getContext();
    if (host != null)
      host.invalidateOptionsMenu();

    mVideoBox.setVisibility(View.INVISIBLE);

    // reset this so it's 00:00 next time it's shown
    mTimeRemainingTextView.setText("00:00");

    if (mListener != null) {
      mListener.stateChanged();
    }
  }

  private void showSeekPopupWindow(View anchorView) {
    LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View popupContentsView = inflater.inflate(R.layout.video_seek_popup, null);
    final PopupWindow pw = new PopupWindow(popupContentsView, LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT, true);  // if false, clicks to dismiss window also get passed to views below (should be true)

    // hack_alert: must set some kind of background so that clicking outside the view will dismiss the popup (known bug in Android)
    pw.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
    pw.setOutsideTouchable(true);
    pw.setAnimationStyle(-1);
    pw.showAsDropDown(anchorView);

    float time = mVideoFragment.getCurrentTimeMillis();
    final float duration = mVideoFragment.getDurationMillis();
    float currentPercent = time / duration;
    int startValue = (int) (currentPercent * 100);

    SeekBar sb = (SeekBar) popupContentsView.findViewById(R.id.video_seek_bar);
    sb.setMax(100);   // using max like a percent
    sb.setProgress(startValue);

    sb.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
      @Override
      public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
        float progressPercent = progress / 100.0f;
        int seekTo = (int) (progressPercent * duration);

        mTimeRemainingTextView.setText(Utils.millisecondsToDuration(seekTo));
      }

      @Override
      public void onStartTrackingTouch(SeekBar seekBar) {
      }

      @Override
      public void onStopTrackingTouch(SeekBar seekBar) {
        // seek when released
        float progressPercent = seekBar.getProgress() / 100.0f;
        int seekTo = (int) (progressPercent * duration);

        mVideoFragment.seekToMillis(seekTo);

        pw.dismiss();
      }
    });

  }

  private void setupToolbar() {
    ImageView b;

    // close button
    b = (ImageView) mVideoBox.findViewById(R.id.close_button);
    b.setImageDrawable(ToolbarIcons.icon(mContext, ToolbarIcons.IconID.CLOSE, Color.WHITE, mIconSize));
    b.setOnClickListener(new View.OnClickListener() {
      @Override
      public void onClick(View v) {
        close();
      }
    });

    // Mute button
    mMuteButton = (ImageView) mVideoBox.findViewById(R.id.mute_button);
    mMuteButton.setOnClickListener(new View.OnClickListener() {
      @Override
      public void onClick(View v) {
        toggleMute();
      }
    });
    updateMuteButton();

    // Skip back button
    b = (ImageView) mVideoBox.findViewById(R.id.skip_back_button);
    b.setImageDrawable(ToolbarIcons.icon(mContext, ToolbarIcons.IconID.STEP_BACK, Color.WHITE, mIconSize));
    b.setOnClickListener(new View.OnClickListener() {
      @Override
      public void onClick(View v) {
        skip(-10);
      }
    });

    // Skip ahead button
    b = (ImageView) mVideoBox.findViewById(R.id.skip_ahead_button);
    b.setImageDrawable(ToolbarIcons.icon(mContext, ToolbarIcons.IconID.STEP_FORWARD, Color.WHITE, mIconSize));
    b.setOnClickListener(new View.OnClickListener() {
      @Override
      public void onClick(View v) {
        skip(10);
      }
    });

    mTimeRemainingTextView = (TextView) mVideoBox.findViewById(R.id.time_remaining);
    mTimeRemainingTextView.setOnClickListener(new View.OnClickListener() {
      @Override
      public void onClick(View v) {
        // put it below toolbar
        View tb = mVideoBox.findViewById(R.id.video_toolbar_view);

        showSeekPopupWindow(tb);
      }
    });

    mSeekFlashTextView = (TextView) mVideoBox.findViewById(R.id.seek_flash);

    // we let the video fragment update us in it's own timer
    mVideoFragment.setTimeRemainingListener(new VideoPlayerFragment.TimeRemainingListener() {

      // call this on the main thread
      @Override
      public void setTimeRemainingText(final String timeRemaining) {
        mTimeRemainingTextView.setText(timeRemaining);
      }

      @Override
      public void setSeekFlashText(final String seekFlash) {
        mSeekFlashTextView.setText(seekFlash);

        int duration = 300;

        // fade old one out
        mTimeRemainingTextView.animate().setDuration(duration).alpha(0.0f);

        // start off off the screen, make visible
        mSeekFlashTextView.setTranslationY(-60.0f);
        mSeekFlashTextView.setVisibility(View.VISIBLE);

        // run animation, new time slides in from top, old time slides off
        mSeekFlashTextView.animate()
            .setDuration(duration)
            .translationY(0)
            .setInterpolator(new BounceInterpolator())
            .withEndAction(new Runnable() {
              @Override
              public void run() {
                mSeekFlashTextView.setVisibility(View.INVISIBLE);

                mTimeRemainingTextView.setText(seekFlash);
                mTimeRemainingTextView.setAlpha(1.0f);
              }
            });
      }

    });
  }

  abstract public interface VideoPlayerStateListener {
    abstract public void stateChanged();
  }

  public static class PlayerParams implements Parcelable {
    public static final Parcelable.Creator<PlayerParams> CREATOR = new Parcelable.Creator<PlayerParams>() {
      public PlayerParams createFromParcel(Parcel in) {
        return new PlayerParams(in);
      }

      public PlayerParams[] newArray(int size) {
        return new PlayerParams[size];
      }
    };
    public final String videoId;
    public final String title;
    public final int index;  // used for the play_next feature if enabled

    public PlayerParams(String videoId, String title, int index) {
      this.videoId = videoId;
      this.title = title;
      this.index = index;
    }

    // ===================================================================
    //  Parcelable - we send this to the service inside an intent

    private PlayerParams(Parcel in) {
      videoId = in.readString();
      title = in.readString();
      index = in.readInt();
    }

    public boolean equals(PlayerParams inParams) {
      if (inParams == null)
        return false;

      if (index != inParams.index)
        return false;
      if (!videoId.equals(inParams.videoId))
        return false;
      if (!title.equals(inParams.title))
        return false;

      return true;
    }

    @Override
    public int describeContents() {
      return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
      dest.writeString(videoId);
      dest.writeString(title);
      dest.writeInt(index);
    }
  }

}


text:
ARG DJANGO_CONTAINER_VERSION=1.4.1

FROM gcr.io/uwit-mci-axdd/django-container:${DJANGO_CONTAINER_VERSION} as app-container

USER root
RUN apt-get update && apt-get install mysql-client libmysqlclient-dev -y
USER acait

ADD --chown=acait:acait scheduler/VERSION /app/scheduler/
ADD --chown=acait:acait setup.py /app/
ADD --chown=acait:acait requirements.txt /app/

RUN . /app/bin/activate && pip install -r requirements.txt

RUN . /app/bin/activate && pip install mysqlclient

RUN . /app/bin/activate && pip install nodeenv && nodeenv --node=14.15.0 -p &&\
    npm install -g npm &&\
    ./bin/npm install less@3.13.1 -g

ADD --chown=acait:acait . /app/
ADD --chown=acait:acait docker/ project/

RUN . /app/bin/activate && python manage.py collectstatic --noinput &&\
    python manage.py compress -f

FROM gcr.io/uwit-mci-axdd/django-test-container:${DJANGO_CONTAINER_VERSION} as app-test-container

COPY --from=app-container  /app/ /app/
COPY --from=app-container  /static/ /static/


text:
> Generate a unique, sequential ID. Optionally pass a prefix, suffix, or multiplier.

## Install
#### Install with [npm](npmjs.org):

```bash
npm i uniqueid --save-dev
```

## Run tests

```bash
npm test
```

## Usage

```js
var uniqueId = require('uniqueid');
console.log(uniqueId('abc'));
//=> ['a', 'b', 'c'];
```

## API
### [id](index.js#L32)

Generate a unique ID.

* `options` **{Object}**: Optionally pass a `prefix`, `suffix` and/or `multiplier.
* `returns` **{String}**: The unique id.

Optionally pass a prefix to prepend, a suffix to append, or a
multiplier to use on the ID.

```js
uniqueId(); //=> '25'

uniqueId({prefix: 'apple_'});
//=> 'apple_10'

uniqueId({suffix: '_orange'});
//=> '10_orange'

uniqueId({multiplier: 5});
//=> 5, 10, 15, 20...
```

To reset the `id` to zero, do `id.reset()`.

## Author

**Jon Schlinkert**

+ [github/jonschlinkert](https://github.com/jonschlinkert)
+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert)

## License
Copyright (c) 2014 Jon Schlinkert, contributors.
Released under the MIT license

***

_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on September 14, 2014._


text:
import { EntityType, IEntityObject, IPartyMember } from '../base-entity';
import { Armor, Weapon } from '../item';

/**
 * Define the slots available for equipping items on an Entity. Each slot
 * can be assigned a string itemId that corresponds to an item in the entity
 * collection.
 */
export interface EntitySlots {
  /** Entity id for the equipped weapon */
  readonly weapon?: string | null;
  /** Entity id for the equipped armor */
  readonly armor?: string | null;
  /** Entity id for the equipped boots */
  readonly boots?: string | null;
  /** Entity id for the equipped helm */
  readonly helm?: string | null;
  /** Entity id for the equipped shield */
  readonly shield?: string | null;
  /** Entity id for the equipped accessory */
  readonly accessory?: string | null;
}

export interface Entity extends IEntityObject, EntitySlots, IPartyMember {
  readonly type: EntityType;
  readonly exp: number;
}

/**
 * When rendering UI elements it is very helpful to have an object with equipment resolved
 * to the underlying Item entities. This type represents that mapping. {@see getEntityEquipment} for
 * a store selector that returns this type.
 */
export interface EntityWithEquipment extends IPartyMember {
  readonly weapon?: Weapon | null;
  /** Entity id for the equipped armor */
  readonly armor?: Armor | null;
  /** Entity id for the equipped boots */
  readonly boots?: Armor | null;
  /** Entity id for the equipped helm */
  readonly helm?: Armor | null;
  /** Entity id for the equipped shield */
  readonly shield?: Armor | null;
  /** Entity id for the equipped accessory */
  readonly accessory?: Armor | null;
}


text:
package es.tid.bgp.bgp4.update.fields;

import es.tid.bgp.bgp4.objects.BGP4Object;

/**
 * Withdrawn Routes:

         This is a variable-length field that contains a list of IP
         address prefixes for the routes that are being withdrawn from
         service.  Each IP address prefix is encoded as a 2-tuple of the
         form {@code<length, prefix>}, whose fields are described below:
<pre>
                  +---------------------------+
                  |   Length (1 octet)        |
                  +---------------------------+
                  |   Prefix (variable)       |
                  +---------------------------+
</pre>
   The use and the meaning of these fields are as follows:

         a) Length:

            The Length field indicates the length in bits of the IP
            address prefix.  A length of zero indicates a prefix that
            matches all IP addresses (with prefix, itself, of zero
            octets).

         b) Prefix:

            The Prefix field contains an IP address prefix, followed by
            the minimum number of trailing bits needed to make the end
            of the field fall on an octet boundary.  Note that the value
            of trailing bits is irrelevant.
 * @author mcs
 *
 */
public class WithdrawnRoutes extends BGP4Object{
	private int length;
	private byte[] prefix;//FIXME: pensar

	public void encode(){

	}

	public int getLength() {
		return length;
	}

	public void setLength(int length) {
		this.length = length;
	}

	public byte[] getPrefix() {
		return prefix;
	}

	public void setPrefix(byte[] prefix) {
		this.prefix = prefix;
	}

}


text:
layout: archive
title: Log
permalink: /log/
category: "log"
tagline: "Admiral entry number…"
---


text:
require File.expand_path('../../../spec_helper', __FILE__)
require 'date'

describe "Date#leap?" do
  it "needs to be reviewed for spec completeness"
end

describe "Date.leap?" do
  it "needs to be reviewed for spec completeness"
end


text:
adoptmyapp
==========

Adopt My App is an app that helps people share and rescue abandoned apps and hackathon projects


text:
<?xml version="1.0"?>
<cd:ProductDefinition xmlns:cd="http://www.stcorp.nl/coda/definition/2008/07" id="UVVIS_DOAS_OFFAXIS_AEROSOL_007_hdf4" format="hdf4" last-modified="2017-10-05">
</cd:ProductDefinition>


text:
import { Observable } from '../Observable';
/**
 * Returns an Observable that repeats the stream of items emitted by the source Observable at most count times.
 *
 * <img src="./img/repeat.png" width="100%">
 *
 * @param {number} [count] The number of times the source Observable items are repeated, a count of 0 will yield
 * an empty Observable.
 * @return {Observable} An Observable that repeats the stream of items emitted by the source Observable at most
 * count times.
 * @method repeat
 * @owner Observable
 */
export declare function repeat<T>(this: Observable<T>, count?: number): Observable<T>;


text:
"""

Note: This is an extension of House Robber.

After robbing those houses on that street, the thief has found himself a new place for his thievery so that he will not get too much attention. This time, all houses at this place are arranged in a circle. That means the first house is the neighbor of the last one. Meanwhile, the security system for these houses remain the same as for those in the previous street.

Given a list of non-negative integers representing the amount of money of each house, determine the maximum amount of money you can rob tonight without alerting the police.

"""

class Solution:

	# @param {integer[]} nums
	# @return {integer}
	def rob(self, nums):
		n = len(nums)

		# base cases
		if n == 0: return 0
		if n == 1: return nums[0]

		# we have 2 options (1) rob house 0 (2) rob house n-1
		# (1) solve for interval [0, n-2] (leave house n-1)
		rob_first = self.rob_helper(nums, 0, n-2)

		# (2) solve for interval [1, n-1] (leave house 0)
		rob_last = self.rob_helper(nums, 1, n-1)

		# answer is the max of the 2 options
		return max(rob_first, rob_last)

	# @param {integer[]} nums
	# @param {integer} start
	# @param {integer} end
	# @return {integer}
	def rob_helper(self, nums, start, end):
		n = end - start + 1

		# base cases ... n < 2
		if n == 1: return nums[start]
		if n == 2: return max(nums[start], nums[start+1])

		# general case when n > 2
		# dp[i] = max(dp[i-1], dp[i-2] + nums[i])
		#dp = [0] * n
		dp = [0] * n
		dp[0] = nums[start]
		dp[1] = max(nums[start], nums[start+1])
		for i in range(2, n):
			dp[i] = max(dp[i-1], dp[i-2] + nums[start+i])
		return dp[n-1]

s = Solution()
print s.rob([1,16,5,20])


text:
<?php

declare(strict_types=1);

namespace Sprout\Exception;

class InvalidArgumentException extends \InvalidArgumentException
{
}


text:
package com.lohasle.baseframe.s4m3.util;

import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;
import java.util.Properties;

/**
 * 资源加载工具
 *
 * @author 付乐
 * @createTime 2013-8-21
 */
public class ResourceLoadUtil {

    /**
     * 加载xml Properties
     *
     * @param XMLPath
     * @param cz
     * @return
     * @throws java.io.IOException
     */
    public static Properties loadPropertiesFromXML(String XMLPath, Class cz) throws IOException {
        URL url = cz.getResource(XMLPath);
        InputStream is = null;
        URLConnection con = null;
        Properties p = new Properties();
        try {
            con = url.openConnection();
            p.loadFromXML(is = con.getInputStream());
        } catch (IOException e) {
            throw e;
        } finally {
            if (is != null) {
                try {
                    is.close();
                } catch (IOException e) {
                    throw e;
                }
            }
        }
        return p;
    }

}


text:
input, span { background-color : red }
input:checked, input:checked + span { background-color : lime}


text:
1.[Descritivo do Problema](https://drive.google.com/open?id=0Bx1VVgelLTO_YjhaRm5OMGZSd3c)

2.[Descritivo do Problema](https://goo.gl/photos/bhwj33B1ZBc6TqQF8)

3.[Descritivo do Problema - Parte I](https://drive.google.com/open?id=0Bx1VVgelLTO_YzRmLWFLMGI3RVU) [Descritivo do Problema - Parte II](https://drive.google.com/open?id=0Bx1VVgelLTO_OURPM3N6UlBVbUk)

## Links úteis ##

1.[Manual Kit FPGA ACEX 1K](https://drive.google.com/open?id=0Bx1VVgelLTO_aHVJVFlheWpMVms)

2.[Circuitos Integrados família 74 disponíveis no Quartus II 9.0](http://susta.cz/fel/74/index_eng.htm)

3.[Altera Megafunction Overview User Guide](https://www.altera.com.cn/zh_CN/pdfs/literature/ug/ug_megafunction_overview.pdf)

4.[Tutorial para criar e simular circuitos digitais no Altera Quartus II](https://www2.pcs.usp.br/~labdig/material/GuiaResumido-Quartus_II_91_corrigida.pdf)

5.[Online Karnaugh map solver with circuit for up to 8 variable](http://www.32x8.com/)

6.[Quine-McCluskey Solver](http://quinemccluskey.com/)

## Material Sobre Máquina de Estados ##

1.[BROWN, Stephen D; VRANESIC, Zvonko G. Syncronous Finite State Machines. In: **Fundamentals of digital logic with Verilog design**. Cap.8, p.480-573](https://drive.google.com/open?id=0Bx1VVgelLTO_T096X2JrRV8tWHM)


text:
package de.bluemx.stocktool.helper;

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;

class StringUtilTest {

    private StringUtil stringUtil;

    @BeforeEach
    void beforeEach() {
        stringUtil = new StringUtil();
    }

    /**
     * Tests if placeholder will work
     */
    @Test
    void testReplacePlaceholder() {
        String testString = "TEXT1 {to_replace} TEXT3";
        String search = "to_replace";
        String result = "TEXT1 TEXT2 TEXT3";
        String replacement = "TEXT2";
        String actual = stringUtil.replacePlaceholder(testString, search, replacement);
        assertEquals(result, actual);
    }

    /**
     * Tests Assertion if no placeholder exists
     */
    @Test
    void testAssertionNoPlaceholder() {
        String testString = "TEXT1 TEXT3";
        String search = "to_replace";
        String replacement = "TEXT2";
        assertThrows(IllegalArgumentException.class,
                () -> stringUtil.replacePlaceholder(testString, search, replacement));
    }

    /**
     * Tests assertion if more than one variable with same name exists.
     */
    @Test
    void testAssertionTooMuchPlaceholders() {
        String testString = "TEXT1 {to_replace} TEXT3 {to_replace}";
        String search = "to_replace";
        String replacement = "TEXT2";
        assertThrows(IllegalArgumentException.class,
                () -> stringUtil.replacePlaceholder(testString, search, replacement));
    }

}


text:
var expressionParser = (function _expressionParser() {
    var tokens = {
        rightParens: ')',
        leftParens: '(',
        AND: 'and',
        OR: 'or',
        XOR: 'xor',
        XAND: 'xand',
        XNOR: 'xnor',
        NOR: 'nor',
        NAND: 'nand',
        NOT: '!'
    };

    var dateTimeRegex = '^(((?:(?:(?:(?:(?:(?:(?:(0?[13578]|1[02])(\\/|-|\\.)(31))\\4|(?:(0?[1,3-9]|1[0-2])(\\/|-|\\.)(29|30)\\7))|(?:(?:(?:(?:(31)(\\/|-|\\.)(0?[13578]|1[02])\\10)|(?:(29|30)(\\/|-|\\.)' +
        '(0?[1,3-9]|1[0-2])\\13)))))((?:1[6-9]|[2-9]\\d)?\\d{2})|(?:(?:(?:(0?2)(\\/|-|\\.)(29)\\17)|(?:(29)(\\/|-|\\.)(0?2))\\20)((?:(?:1[6-9]|[2-9]\\d)?(?:0[48]|[2468][048]|[13579][26])' +
        '|(?:(?:16|[2468][048]|[3579][26])00))))|(?:(?:((?:0?[1-9])|(?:1[0-2]))(\\/|-|\\.)(0?[1-9]|1\\d|2[0-8]))\\24|(0?[1-9]|1\\d|2[0-8])(\\/|-|\\.)((?:0?[1-9])|(?:1[0-2]))\\27)' +
        '((?:1[6-9]|[2-9]\\d)?\\d{2}))))|(?:(?:((?:1[6-9]|[2-9]\\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00)))(\\/|-|\\.)(?:(?:(?:(0?2)(?:\\31)(29))))' +
        '|((?:1[6-9]|[2-9]\\d)?\\d{2})(\\/|-|\\.)(?:(?:(?:(0?[13578]|1[02])\\35(31))|(?:(0?[1,3-9]|1[0-2])\\35(29|30)))|((?:0?[1-9])|(?:1[0-2]))\\35(0?[1-9]|1\\d|2[0-8])))))' +
        '(?: |T)((0?[1-9]|1[012])(?:(?:(:|\\.)([0-5]\\d))(?:\\44([0-5]\\d))?)?(?:(\\ [AP]M))$|([01]?\\d|2[0-3])(?:(?:(:|\\.)([0-5]\\d))(?:\\49([0-5]\\d))?)$))';

    var booleanExpressionTree = {
        init: function _init() {
            this.tree = null;
            this.context = null;
            this.rootNode = null;
            return this;
        }
    };

    booleanExpressionTree.setTree = function _setTree(tree) {
        this.queue = tree;
        this.rootNode = tree[this.queue.length - 1];
        return this;
    };
    booleanExpressionTree.createTree = function _createTree() {
        this.queue.pop;
        if (this.queue.length)
            this.rootNode.addChildren(this.queue);
    };
    booleanExpressionTree.filterCollection = function _filterCollection(collection) {
        return collection.filter(function collectionMap(curr) {
            this.context = curr;
            return this.rootNode.evaluate(curr);
        }, this);
    };
    booleanExpressionTree.internalGetContext = function _internalGetContext() {
        return this.context;
    };
    booleanExpressionTree.getContext = function _getContext() {
        return this.internalGetContext.bind(this);
    };
    booleanExpressionTree.isTrue = function _isTrue(item) {
        this.context = item;
        return this.rootNode.value;
    };

    var astNode = {
        createNode: function _createNode(node) {
            var operatorCharacteristics = getOperatorPrecedence(node);
            if (operatorCharacteristics) {
                this.operator = node;
                this.numberOfOperands = getNumberOfOperands(this.operator);
                this.precedence = operatorCharacteristics.precedence;
                this.associativity = operatorCharacteristics.associativity;
                this.children = [];
            }
            else {
                this.field = node.field;
                this.standard = node.value;
                this.operation = node.operation;
                this.dataType = node.dataType;
                this.context = null;
            }
            this._value = null;
            this.getContext = null;
            this.queue = null;
        }
    };

    astNode.createTree = function _createTree(queue) {
        this.queue = queue.reverse();
        this.tree = this.queue;
        this.addChildren(this.queue);
    };

    astNode.addChildren = function _addChildren(tree) {
        if (this.children && this.children.length < this.numberOfOperands) {
            var child = tree.pop;
            child.addChildren(tree);
            this.children.push(child);
            child = tree.pop;
            child.addChildren(tree);
            this.children.push(child);
        }
        return this;
    };

    astNode.addChild = function _addChild(child) {
        if (this.children && this.children.length < this.numberOfOperands)
            this.children.push(child);
        return this;
    };

    astNode.evaluate = function _evaluate() {
        if (this.children && this.children.length) {
            switch (this.operator) {
                case tokens.OR:
                    return this.children[1].evaluate() || this.children[0].evaluate();
                case tokens.AND:
                    return this.children[1].evaluate() && this.children[0].evaluate();
                case tokens.XOR:
                    return !!(this.children[1].evaluate() ^ this.children[0].evaluate());
                case tokens.NOR:
                    return !(this.children[1].evaluate() || this.children[0].evaluate());
                case tokens.NAND:
                    return !(this.children[1].evaluate() && this.children[0].evaluate());
                case tokens.XNOR:
                    return !(this.children[1].evaluate() ^ this.children[0].evaluate());
            }
        }
        else {
            var baseVal,
                curVal,
                initialVal = this.getContext()[this.field];

            switch(this.dataType == null ? typeof this.getContext()[this.field] : this.dataType) {
                case 'time':
                    curVal = getNumbersFromTime(initialVal);
                    baseVal = getNumbersFromTime(this.standard);

                    if (initialVal.indexOf('PM') > -1) curVal[0] += 12;
                    if (this.standard.indexOf('PM') > -1) baseVal[0] += 12;

                    curVal = convertTimeArrayToSeconds(curVal);
                    baseVal = convertTimeArrayToSeconds(baseVal);
                    break;
                case 'datetime':
                    var re = new RegExp(dateTimeRegex),
                        execVal1, execVal2;
                    if (re.test(initialVal) && re.test(this.standard)) {
                        execVal1 = re.exec(initialVal);
                        execVal2 = re.exec(this.standard);

                        var dateComp1 = execVal1[2],
                            dateComp2 = execVal2[2],
                            timeComp1 = execVal1[42],
                            timeComp2 = execVal2[42];

                        timeComp1 = getNumbersFromTime(timeComp1);
                        timeComp2 = getNumbersFromTime(timeComp2);
                        if (timeComp1[3] && timeComp1[3] === 'PM')
                            timeComp1[0] += 12;
                        if (timeComp2[3] && timeComp2[3] === 'PM')
                            timeComp2[0] += 12;

                        dateComp1 = new Date(dateComp1);
                        dateComp2 = new Date(dateComp2);
                        curVal = dateComp1.getTime() + convertTimeArrayToSeconds(timeComp1);
                        baseVal = dateComp2.getTime() + convertTimeArrayToSeconds(timeComp2);
                    }
                    else {
                        curVal = 0;
                        baseVal = 0;
                    }
                    break;
                case 'number':
                    curVal = parseFloat(initialVal);
                    baseVal = parseFloat(this.standard);
                    break;
                case 'date':
                    curVal = new Date(initialVal);
                    baseVal = new Date(this.standard);
                    break;
                case 'boolean':
                    curVal = initialVal.toString();
                    baseVal = this.standard.toString();
                    break;
                default:
                    curVal = initialVal.toString();
                    baseVal = this.standard.toString();
                    break;
            }

            this._value = comparator(curVal, baseVal, this.operation);
            return this._value;
        }
    };

    astNode.getValue = function _getValue() {
        if (this._value == null)
            this._value = this.evaluate();
        return this._value;
    };

    Object.defineProperty(astNode, 'value', {
        get: function _getValue() {
            if (!this._value) {
                this._value = this.evaluate();
            }
            return this._value;
        }
    });

    function getNodeContext(bet) {
        return bet.internalGetContext.bind(bet);
    }

    function createFilterTreeFromFilterObject(filterObject) {
        var ret = Object.create(booleanExpressionTree);
        ret.init();
        var operandStack = Object.create(stack).init();
        var queue = [],
            topOfStack;

        iterateFilterGroup(filterObject, operandStack, queue, getNodeContext(ret));

        while (operandStack.length) {
            topOfStack = operandStack.peek;
            if (topOfStack.operator !== tokens.leftParens)
                queue.push(operandStack.pop);
            else operandStack.pop;
        }

        ret.setTree(queue);
        ret.createTree();
        return ret;
    }

    function iterateFilterGroup(filterObject, stack, queue, contextGetter) {
        var conjunction = filterObject.conjunct,
            idx = 0,
            topOfStack;

        while (idx < filterObject.filterGroup.length) {
            if (idx > 0) {
                var conjunctObj = Object.create(astNode);
                conjunctObj.createNode(conjunction);
                pushConjunctionOntoStack(conjunctObj, stack, queue);
            }
            if (filterObject.filterGroup[idx].conjunct) {
                var paren = Object.create(astNode);
                paren.createNode(tokens.leftParens);
                stack.push(paren);
                iterateFilterGroup(filterObject.filterGroup[idx], stack, queue, contextGetter);
                while (stack.length) {
                    topOfStack = stack.peek;
                    if (topOfStack.operator !== tokens.leftParens)
                        queue.push(stack.pop);
                    else {
                        stack.pop;
                        break;
                    }
                }
            }
            else {
                var leafNode = Object.create(astNode);
                leafNode.createNode(filterObject.filterGroup[idx]);
                leafNode.getContext = contextGetter;
                queue.push(leafNode);
            }
            ++idx;
        }
    }

    function pushConjunctionOntoStack(conjunction, stack, queue) {
        while (stack.length) {
            var topOfStack = stack.peek;
            if ((conjunction.associativity === associativity.LTR && conjunction.precedence <= topOfStack.precedence)
                || (conjunction.associativity === associativity.RTL && conjunction.precedence < topOfStack.precedence))
                queue.push(stack.pop);
            else
                break;
        }
        stack.push(conjunction);
    }

    var stack = {
        init: function _init() {
            this.data = [];
            this.top = 0;
            return this;
        },
        push: function _push(item) {
            this.data[this.top++] = item;
            return this;
        },
        get pop() {
            return this.data[--this.top];
        },
        get peek() {
            return this.data[this.top - 1];
        },
        get clear() {
            this.top = 0;
            return this;
        },
        get length() {
            return this.top;
        }
    };

    function comparator(val, base, type) {
        switch (type) {
            case 'eq':
            case '===':
                return val === base;
            case '==':
                return val == base;
            case 'neq':
            case '!==':
                return val !== base;
            case '!=':
                return val != base;
            case 'gte':
            case '>=':
                return val >= base;
            case 'gt':
            case '>':
                return val > base;
            case 'lte':
            case '<=':
                return val <= base;
            case 'lt':
            case '<':
                return val < base;
            case 'not':
            case '!':
            case 'falsey':
                return !val;
            case 'truthy':
                return !!val;
            case 'ct':
                return !!~val.toLowerCase().indexOf(base.toLowerCase());
            case 'nct':
                return !~val.toLowerCase().indexOf(base.toLowerCase());
        }
    }

    function getNumberOfOperands(operator) {
        switch (operator) {
            case tokens.NOT:
                return 1;
            case tokens.leftParens:
            case tokens.rightParens:
                return 0;
            default:
                return 2;
        }
    }

    var associativity = { RTL: 1, LTR: 2 };

    function getOperatorPrecedence(operator) {
        switch (operator) {
            case tokens.NOT:
                return {
                    precedence: 1,
                    associativity: associativity.LTR
                };
            case tokens.AND:
                return {
                    precedence: 2,
                    associativity: associativity.RTL
                };
            case tokens.XOR:
                return {
                    precedence: 3,
                    associativity: associativity.RTL
                };
            case tokens.OR:
                return {
                    precedence: 4,
                    associativity: associativity.RTL
                };
            case tokens.leftParens:
            case tokens.rightParens:
                return {
                    precedence: null,
                    associativity: null
                };
            default:
                return null;
        }
    }

    function getNumbersFromTime(val) {
        var re = /^(0?[1-9]|1[012])(?:(?:(:|\.)([0-5]\d))(?:\2([0-5]\d))?)?(?:(\ [AP]M))$|^([01]?\d|2[0-3])(?:(?:(:|\.)([0-5]\d))(?:\7([0-5]\d))?)$/;
        if (!re.test(val)) return [];
        var timeGroups = re.exec(val);
        var hours = timeGroups[1] ? +timeGroups[1] : +timeGroups[6];
        var minutes, seconds, meridiem, retVal = [];
        if (timeGroups[2]) {
            minutes = timeGroups[3] || '00';
            seconds = timeGroups[4]  || '00';
            meridiem = timeGroups[5].replace(' ', '') || null;
        }
        else if (timeGroups[6]) {
            minutes = timeGroups[8] || '00';
            seconds = timeGroups[9] || '00';
        }
        else{
            minutes = '00';
            seconds = '00';
        }
        retVal.push(hours);
        retVal.push(minutes);
        retVal.push(seconds);
        if (meridiem) retVal.push(meridiem);
        return retVal;
    }

    function convertTimeArrayToSeconds(timeArray) {
        var hourVal = parseInt(timeArray[0].toString()) === 12 || parseInt(timeArray[0].toString()) === 24 ? parseInt(timeArray[0].toString()) - 12 : parseInt(timeArray[0]);
        return 3660 * hourVal + 60 * parseInt(timeArray[1]) + parseInt(timeArray[2]);
    }

    return {
        createFilterTreeFromFilterObject: createFilterTreeFromFilterObject
    };
})();


text:
<resources>
    <string name="app_name">AndroidBeginner</string>
</resources>


text:
#ifndef KBUFFER_H
#define KBUFFER_H

#ifdef __cplusplus
extern "C"{
#endif

#include <stdint.h>

/**
 * @brief The datatype of one buffer element.
 * As default, it is an 16 bit unsigned integer. Feel free to change it to your needs
 */
#ifndef bufferDatatype
	#define bufferDatatype uint16_t
#endif

/**
 * @brief Enables mean/ averaging functions.
 * If you uncomment this define, the following functions will be compiled.

 * Only enable it, if bufferDatatype is some sort of numeric datatype (integer, float, ...)

 * bufferMean();

 * bufferMeanRMS();

 */
#define BUFFER_ENABLE_MEAN

/**
 * @brief Struct for buffer handling.
 * If you need a ringbuffer in your software, you should instantiate a buffer_t, and run the neccessary functions with a pointer to your instance
 */
typedef struct{
    /// is 0 if the buffer is not initialized
    uint8_t isInitialized;
    /// The write pointer of the buffer. At a write procedure, data gets written and the pointer is incremented
    uint16_t writePointer;
    /// The read pointer of the buffer. At a read procedure, data gets read and the pointer is incremented
    uint16_t readPointer;
    /// The number of elements in the buffer
    uint16_t length;
    /// The number of bytes of one buffer element. The total memory consumption in Bytes is equal to length * elementLength
    uint8_t elementLength;
    /// A variable which is increased by one when new data gets written and decremented by one when data is read
    uint16_t datacount;
    /// A pointer to the first element of the buffer. Length * elementLength bytes of memory are allocated after this pointer
    bufferDatatype* data;
}buffer_t;

/**
 * @enum bufferStatus_t
 * @brief buffer function return codes
 */
typedef enum{
    /** it seems, as everything worked as expected */
    bufferOK = 0,
    /** happens while allocating memory,
there is not enough free memory (->malloc failed) */
    bufferMemoryAllocationFailed,
    /** happens at reading data,
buffer is empty and there is no more data to read */
    bufferEmpty,
    /** happens at writing data,
buffer is full, no more data can be written */
    bufferFull,
    /** The buffer is not initialized */
    bufferNotInitialized,
    /** an error occured, which isn't explained nearer. Have a look at the according function */
    bufferError
}bufferStatus_t;

//Function declearations

bufferStatus_t bufferInit(buffer_t* buffer, uint16_t bufferSize);
bufferStatus_t bufferInitStatic(buffer_t* buffer, uint16_t bufferSize, bufferDatatype* bufferArray);
bufferStatus_t bufferWriteToIndex(buffer_t* buffer, uint16_t index, bufferDatatype data);
bufferStatus_t bufferReadFromIndex(buffer_t* buffer, uint16_t index, bufferDatatype* data);
uint8_t bufferIsEmpty(buffer_t* buffer);
uint8_t bufferIsFull(buffer_t* buffer);
bufferStatus_t bufferWrite(buffer_t* buffer, bufferDatatype data);
bufferStatus_t bufferWriteOverwrite(buffer_t* buffer, bufferDatatype data);
bufferStatus_t bufferRead(buffer_t* buffer, bufferDatatype* data);
bufferStatus_t bufferPeek(buffer_t* buffer, bufferDatatype* data);
bufferStatus_t bufferFill(buffer_t* buffer, bufferDatatype data, uint8_t silent);
bufferStatus_t bufferAvailable(buffer_t* buffer, uint16_t* available);

#ifdef BUFFER_ENABLE_MEAN
bufferStatus_t bufferMean(buffer_t* buffer, bufferDatatype* meanOut);
bufferStatus_t bufferMeanRMS(buffer_t* buffer, bufferDatatype* meanOut);
#endif

#ifdef __cplusplus
}
#endif

#endif


text:
layout: post
title:  "100 Days of SwiftUI - Day 25"
date:   2019-10-21 19:36:30 +1300
categories: ohdos
---
According to the rules for taking part in [100 Days of SwiftUI](https://www.hackingwithswift.com/100/swiftui), as soon as I've finished each day, I have to post about it.

The topic for Day 25 was Milestone: Projects 1-3.

This included sections on: What you learned, Key points, and a challenge.

The challenge was to write a "Scissors, Paper, Stone" brain training app, which I have done to a very basic extent.


text:
QEMU_ARGS="-M powernv -nographic -device ipmi-bmc-sim,id=bmc0 -device isa-ipmi-bt,bmc=bmc0,irq=10"

if [ -z "$QEMU_BIN" ]; then
    QEMU_BIN="qemu-system-ppc64"
fi

if [ ! $(command -v $QEMU_BIN) ]; then
    echo "Could not find executable QEMU_BIN ($QEMU_BIN). Skipping hello_world test";
    exit 0;
fi

if [ -n "$KERNEL" ]; then
    echo 'Please rebuild skiboot without KERNEL set. Skipping hello_world test';
    exit 0;
fi

if [ ! $(command -v expect) ]; then
    echo 'Could not find expect binary. Skipping hello_world test';
    exit 0;
fi

export SKIBOOT_ZIMAGE=$(pwd)/test/hello_world/hello_kernel/hello_kernel

t=$(mktemp) || exit 1

trap "rm -f -- '$t'" EXIT

(
cat <<EOF | expect
set timeout 30
spawn $QEMU_BIN -bios skiboot.lid $QEMU_ARGS -kernel $SKIBOOT_ZIMAGE -nographic
expect {
timeout { send_user "\nTimeout waiting for hello world\n"; exit 1 }
eof { send_user "\nUnexpected EOF\n;" exit 1 }
"Machine Check Stop" { exit 1;}
"Hello World!"
}
close
wait
exit 0
EOF
) 2>&1 > $t

r=$?
if [ $r != 0 ]; then
    cat $t
    exit $r
fi

rm -f -- "$t"
trap - EXIT

exit 0;


text:
package eu.bcvsolutions.idm.acc.dto.filter;

import java.util.UUID;

import eu.bcvsolutions.idm.core.api.dto.filter.QuickFilter;

/**
 * Filter for attributes on target system
 *
 * @author Svanda
 *
 */
public class SysSchemaAttributeFilter extends QuickFilter {

	private UUID objectClassId;
	private UUID systemId;
	private String name;

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public UUID getObjectClassId() {
		return objectClassId;
	}

	public void setObjectClassId(UUID objectClassId) {
		this.objectClassId = objectClassId;
	}

	public UUID getSystemId() {
		return systemId;
	}

	public void setSystemId(UUID systemId) {
		this.systemId = systemId;
	}

}


text:
package org.assertj.core.api.floatarray;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.catchThrowable;
import static org.assertj.core.api.Assertions.withPrecision;
import static org.assertj.core.api.BDDAssertions.then;
import static org.assertj.core.error.ShouldNotBeNull.shouldNotBeNull;
import static org.assertj.core.test.FloatArrays.arrayOf;
import static org.mockito.Mockito.verify;

import org.assertj.core.api.FloatArrayAssert;
import org.assertj.core.api.FloatArrayAssertBaseTest;
import org.junit.jupiter.api.Test;

/**
 * Tests for <code>{@link FloatArrayAssert#endsWith(Float[])}</code>.
 *
 * @author Omar Morales Ortega
 */
class FloatArrayAssert_endsWith_with_Float_array_Test extends FloatArrayAssertBaseTest {

  @Test
  void should_fail_if_values_is_null() {
    // GIVEN
    Float[] sequence = null;
    // WHEN
    Throwable thrown = catchThrowable(() -> assertions.endsWith(sequence));
    // THEN
    then(thrown).isInstanceOf(NullPointerException.class)
                .hasMessage(shouldNotBeNull("sequence").create());
  }

  @Test
  void should_pass_if_values_are_in_range_of_precision() {
    // GIVEN
    Float[] values = new Float[] { 2.1f, 2.9f };
    // WHEN/THEN
    assertThat(arrayOf(1.0f, 2.0f, 3.0f)).endsWith(values, withPrecision(0.2f));
  }

  @Override
  protected FloatArrayAssert invoke_api_method() {
    return assertions.endsWith(new Float[] { 1.0f, 2.0f });
  }

  @Override
  protected void verify_internal_effects() {
    verify(arrays).assertEndsWith(getInfo(assertions), getActual(assertions), arrayOf(1.0f, 2.0f));
  }

}


text:
package Skylight.Skylight_Basic;

import java.util.Locale;

import com.thomasdiewald.pixelflow.java.DwPixelFlow;
import com.thomasdiewald.pixelflow.java.render.skylight.DwSceneDisplay;
import com.thomasdiewald.pixelflow.java.render.skylight.DwSkyLight;
import com.thomasdiewald.pixelflow.java.utils.DwBoundingSphere;
import com.thomasdiewald.pixelflow.java.utils.DwVertexRecorder;

import peasy.*;
import processing.core.PApplet;
import processing.core.PGraphics;
import processing.core.PMatrix3D;
import processing.core.PShape;
import processing.opengl.PGraphics3D;

public class Skylight_Basic extends PApplet {

  //
  // Basic setup for the Skylight renderer.
  //
  // Its important to compute or define a most optimal bounding-sphere for the
  // scene. This can be done manually or automatically, as shown in this example.
  //
  // Any existing sketch utilizing the P3D renderer can be extended to use the
  // Skylight renderer.
  //

  int viewport_w = 1280;
  int viewport_h = 720;
  int viewport_x = 230;
  int viewport_y = 0;

  // camera control
  PeasyCam peasycam;

  // scene to render
  PShape shape;

  // renderer
  DwSkyLight skylight;

  public void settings() {
    size(viewport_w, viewport_h, P3D);
    smooth(0);
  }

  public void setup() {
    surface.setLocation(viewport_x, viewport_y);

    // camera
    peasycam = new PeasyCam(this, -4.083,  -6.096,   7.000, 100);
    peasycam.setRotations(  1.085,  -0.477,   2.910);

    // projection
    perspective(60 * DEG_TO_RAD, width/(float)height, 2, 1000);

    // load obj file into shape-object
    shape = loadShape("examples/data/skylight_demo_scene.obj");

    // record list of vertices of the given shape
    DwVertexRecorder vertex_recorder = new DwVertexRecorder(this, shape);

    // compute scene bounding-sphere
    DwBoundingSphere scene_bs = new DwBoundingSphere();
    scene_bs.compute(vertex_recorder.verts, vertex_recorder.verts_count);

    // used for centering and re-scaling the scene
    PMatrix3D mat_scene_bounds = scene_bs.getUnitSphereMatrix();

    // callback for rendering the scene
    DwSceneDisplay scene_display = new DwSceneDisplay(){
      @Override
      public void display(PGraphics3D canvas) {
        displayScene(canvas);
      }
    };

    // library context
    DwPixelFlow context = new DwPixelFlow(this);
    context.print();
    context.printGL();

    // init skylight renderer
    skylight = new DwSkyLight(context, scene_display, mat_scene_bounds);

    // parameters for sky-light
    skylight.sky.param.iterations     = 50;
    skylight.sky.param.solar_azimuth  = 0;
    skylight.sky.param.solar_zenith   = 0;
    skylight.sky.param.sample_focus   = 1; // full sphere sampling
    skylight.sky.param.intensity      = 1.0f;
    skylight.sky.param.rgb            = new float[]{1,1,1};
    skylight.sky.param.shadowmap_size = 256; // quality vs. performance

    // parameters for sun-light
    skylight.sun.param.iterations     = 50;
    skylight.sun.param.solar_azimuth  = 45;
    skylight.sun.param.solar_zenith   = 55;
    skylight.sun.param.sample_focus   = 0.05f;
    skylight.sun.param.intensity      = 1.0f;
    skylight.sun.param.rgb            = new float[]{1,1,1};
    skylight.sun.param.shadowmap_size = 512;

    frameRate(1000);
  }

  public void draw() {

    // when the camera moves, the renderer restarts
    updateCamActiveStatus();
    if(CAM_ACTIVE){
      skylight.reset();
    }

    // update renderer
    skylight.update();

    peasycam.beginHUD();
    // display result
    image(skylight.renderer.pg_render, 0, 0);
//    image(skylight.sky.getSrc(), 0, 0);
    peasycam.endHUD();

    // some info, window title
    int sun_pass = skylight.sun.RENDER_PASS;
    int sky_pass = skylight.sky.RENDER_PASS;
    String txt_fps = String.format(getClass().getName()+ "  [sun: %d]  [sky: %d]  [fps %6.2f]", sun_pass, sky_pass, frameRate);
    surface.setTitle(txt_fps);
  }

  public void displayScene(PGraphics canvas){
    if(canvas == skylight.renderer.pg_render){
      canvas.background(32);
    }
    canvas.shape(shape);
  }

  float[] cam_pos = new float[3];
  boolean CAM_ACTIVE = false;

  public void updateCamActiveStatus(){
    float[] cam_pos_curr = peasycam.getPosition();
    CAM_ACTIVE = false;
    CAM_ACTIVE |= cam_pos_curr[0] != cam_pos[0];
    CAM_ACTIVE |= cam_pos_curr[1] != cam_pos[1];
    CAM_ACTIVE |= cam_pos_curr[2] != cam_pos[2];
    cam_pos = cam_pos_curr;
  }

  public void printCam(){
    float[] pos = peasycam.getPosition();
    float[] rot = peasycam.getRotations();
    float[] lat = peasycam.getLookAt();
    float   dis = (float) peasycam.getDistance();

    System.out.printf(Locale.ENGLISH, "position: (%7.3f, %7.3f, %7.3f)\n", pos[0], pos[1], pos[2]);
    System.out.printf(Locale.ENGLISH, "rotation: (%7.3f, %7.3f, %7.3f)\n", rot[0], rot[1], rot[2]);
    System.out.printf(Locale.ENGLISH, "look-at:  (%7.3f, %7.3f, %7.3f)\n", lat[0], lat[1], lat[2]);
    System.out.printf(Locale.ENGLISH, "distance: (%7.3f)\n", dis);
  }

  public void keyReleased(){
    printCam();
  }

  public static void main(String args[]) {
    PApplet.main(new String[] { Skylight_Basic.class.getName() });
  }
}


text:
package com.linecorp.centraldogma.server.auth.shiro;

import static com.linecorp.centraldogma.server.internal.api.HttpApiUtil.throwResponse;
import static java.util.Objects.requireNonNull;

import java.time.Duration;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import java.util.function.Function;

import javax.annotation.Nullable;

import org.apache.shiro.authc.IncorrectCredentialsException;
import org.apache.shiro.authc.UnknownAccountException;
import org.apache.shiro.authc.UsernamePasswordToken;
import org.apache.shiro.mgt.SecurityManager;
import org.apache.shiro.subject.Subject;
import org.apache.shiro.subject.Subject.Builder;
import org.apache.shiro.util.ThreadContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.fasterxml.jackson.core.JsonProcessingException;

import com.linecorp.armeria.common.AggregatedHttpRequest;
import com.linecorp.armeria.common.HttpRequest;
import com.linecorp.armeria.common.HttpResponse;
import com.linecorp.armeria.common.HttpStatus;
import com.linecorp.armeria.common.MediaType;
import com.linecorp.armeria.common.RequestHeaders;
import com.linecorp.armeria.common.auth.BasicToken;
import com.linecorp.armeria.common.util.Exceptions;
import com.linecorp.armeria.server.AbstractHttpService;
import com.linecorp.armeria.server.ServiceRequestContext;
import com.linecorp.armeria.server.auth.AuthTokenExtractors;
import com.linecorp.centraldogma.internal.Jackson;
import com.linecorp.centraldogma.internal.api.v1.AccessToken;
import com.linecorp.centraldogma.server.auth.Session;
import com.linecorp.centraldogma.server.internal.api.HttpApiUtil;

import io.netty.handler.codec.http.QueryStringDecoder;

/**
 * A service to handle a login request to Central Dogma Web admin service.
 */
final class LoginService extends AbstractHttpService {
    private static final Logger logger = LoggerFactory.getLogger(LoginService.class);

    private final SecurityManager securityManager;
    private final Function<String, String> loginNameNormalizer;
    private final Function<Session, CompletableFuture<Void>> loginSessionPropagator;
    private final Duration sessionValidDuration;

    LoginService(SecurityManager securityManager,
                 Function<String, String> loginNameNormalizer,
                 Function<Session, CompletableFuture<Void>> loginSessionPropagator,
                 Duration sessionValidDuration) {
        this.securityManager = requireNonNull(securityManager, "securityManager");
        this.loginNameNormalizer = requireNonNull(loginNameNormalizer, "loginNameNormalizer");
        this.loginSessionPropagator = requireNonNull(loginSessionPropagator, "loginSessionPropagator");
        this.sessionValidDuration = requireNonNull(sessionValidDuration, "sessionValidDuration");
    }

    @Override
    protected HttpResponse doPost(ServiceRequestContext ctx, HttpRequest req) throws Exception {
        return HttpResponse.from(
                req.aggregate()
                   .thenApply(msg -> usernamePassword(ctx, msg))
                   .thenComposeAsync(usernamePassword -> {
                       ThreadContext.bind(securityManager);
                       Subject currentUser = null;
                       try {
                           currentUser = new Builder(securityManager).buildSubject();
                           currentUser.login(usernamePassword);

                           final org.apache.shiro.session.Session session = currentUser.getSession(false);
                           final String sessionId = session.getId().toString();
                           final Session newSession =
                                   new Session(sessionId, usernamePassword.getUsername(),
                                               sessionValidDuration);
                           final Subject loginUser = currentUser;
                           // loginSessionPropagator will propagate the authenticated session to all replicas
                           // in the cluster.
                           return loginSessionPropagator.apply(newSession).handle((unused, cause) -> {
                               if (cause != null) {
                                   ThreadContext.bind(securityManager);
                                   logoutUserQuietly(ctx, loginUser);
                                   ThreadContext.unbindSecurityManager();
                                   return HttpApiUtil.newResponse(ctx, HttpStatus.INTERNAL_SERVER_ERROR,
                                                                  Exceptions.peel(cause));
                               }

                               logger.debug("{} Logged in: {} ({})",
                                            ctx, usernamePassword.getUsername(), sessionId);

                               // expires_in means valid seconds of the token from the creation.
                               final AccessToken accessToken =
                                       new AccessToken(sessionId, sessionValidDuration.getSeconds());
                               try {
                                   return HttpResponse.of(HttpStatus.OK, MediaType.JSON_UTF_8,
                                                          Jackson.writeValueAsBytes(accessToken));
                               } catch (JsonProcessingException e) {
                                   return HttpApiUtil.newResponse(ctx, HttpStatus.INTERNAL_SERVER_ERROR, e);
                               }
                           });
                       } catch (IncorrectCredentialsException e) {
                           // Not authorized
                           logger.debug("{} Incorrect password: {}", ctx, usernamePassword.getUsername());
                           return CompletableFuture.completedFuture(
                                   HttpApiUtil.newResponse(ctx, HttpStatus.UNAUTHORIZED, "Incorrect password"));
                       } catch (UnknownAccountException e) {
                           logger.debug("{} unknown account: {}", ctx, usernamePassword.getUsername());
                           return CompletableFuture.completedFuture(
                                   HttpApiUtil.newResponse(ctx, HttpStatus.UNAUTHORIZED, "unknown account"));
                       } catch (Throwable t) {
                           logger.warn("{} Failed to authenticate: {}", ctx, usernamePassword.getUsername(), t);
                           return CompletableFuture.completedFuture(
                                   HttpApiUtil.newResponse(ctx, HttpStatus.INTERNAL_SERVER_ERROR, t));
                       } finally {
                           logoutUserQuietly(ctx, currentUser);
                           ThreadContext.unbindSecurityManager();
                       }
                   }, ctx.blockingTaskExecutor()));
    }

    private static void logoutUserQuietly(ServiceRequestContext ctx, @Nullable Subject user) {
        try {
            if (user != null && !user.isAuthenticated()) {
                user.logout();
            }
        } catch (Exception cause) {
            logger.debug("{} Failed to logout a user: {}", ctx, user, cause);
        }
    }

    /**
     * Returns {@link UsernamePasswordToken} which holds a username and a password.
     */
    private UsernamePasswordToken usernamePassword(ServiceRequestContext ctx, AggregatedHttpRequest req) {
        // check the Basic HTTP authentication first (https://tools.ietf.org/html/rfc7617)
        final BasicToken basicToken = AuthTokenExtractors.basic().apply(RequestHeaders.of(req.headers()));
        if (basicToken != null) {
            return new UsernamePasswordToken(basicToken.username(), basicToken.password());
        }

        final MediaType mediaType = req.headers().contentType();
        if (mediaType != MediaType.FORM_DATA) {
            return throwResponse(ctx, HttpStatus.BAD_REQUEST,
                                 "The content type of a login request must be '%s'.", MediaType.FORM_DATA);
        }

        final Map<String, List<String>> parameters = new QueryStringDecoder(req.contentUtf8(),
                                                                            false).parameters();
        // assume that the grant_type is "password"
        final List<String> usernames = parameters.get("username");
        final List<String> passwords = parameters.get("password");
        if (usernames != null && passwords != null) {
            final String username = usernames.get(0);
            final String password = passwords.get(0);
            return new UsernamePasswordToken(loginNameNormalizer.apply(username), password);
        }

        return throwResponse(ctx, HttpStatus.BAD_REQUEST,
                             "A login request must contain username and password.");
    }
}


text:
package com.datastax.driver.core;

import com.datastax.driver.core.exceptions.NoHostAvailableException;
import org.testng.annotations.Test;

import java.util.concurrent.TimeUnit;

import static com.datastax.driver.core.Assertions.assertThat;
import static com.datastax.driver.core.CCMBridge.DEFAULT_CLIENT_TRUSTSTORE_FILE;
import static com.datastax.driver.core.CCMBridge.DEFAULT_CLIENT_TRUSTSTORE_PASSWORD;
import static com.datastax.driver.core.CreateCCM.TestMode.PER_METHOD;

@CreateCCM(PER_METHOD)
@CCMConfig(auth = false)
public class SSLEncryptionTest extends SSLTestBase {

    /**
     *

     * Validates that an SSL connection can be established without client auth if the target
     * cassandra cluster is using SSL and does not require auth.
     *

     *
     * @test_category connection:ssl
     * @expected_result Connection can be established to a cassandra node using SSL.
     */
    @Test(groups = "short", dataProvider = "sslImplementation", dataProviderClass = SSLTestBase.class)
    public void should_connect_with_ssl_without_client_auth_and_node_doesnt_require_auth(SslImplementation sslImplementation) throws Exception {
        connectWithSSLOptions(getSSLOptions(sslImplementation, false, true));
    }

    /**
     *

     * Validates that an SSL connection can not be established if the client does not trust
     * the cassandra node's certificate.
     *

     *
     * @test_category connection:ssl
     * @expected_result Connection can not be established to a cassandra node using SSL with an untrusted cert.
     */
    @Test(groups = "short", dataProvider = "sslImplementation", dataProviderClass = SSLTestBase.class, expectedExceptions = {NoHostAvailableException.class})
    public void should_not_connect_with_ssl_without_trusting_server_cert(SslImplementation sslImplementation) throws Exception {
        connectWithSSLOptions(getSSLOptions(sslImplementation, false, false));
    }

    /**
     *

     * Validates that an SSL connection can not be established if the client is not specifying SSL, but
     * the cassandra node is using SSL.
     *

     *

     *

     * Note that future versions of cassandra may support both SSL-encrypted and non-SSL connections
     * simultaneously (CASSANDRA-8803)
     *

     *
     * @test_category connection:ssl
     * @expected_result Connection can not be established to a cassandra node using SSL and the client not using SSL.
     */
    @Test(groups = "short", expectedExceptions = {NoHostAvailableException.class})
    public void should_not_connect_without_ssl_but_node_uses_ssl() throws Exception {
        Cluster cluster = register(Cluster.builder()
                .addContactPoints(getContactPoints())
                .withPort(ccm().getBinaryPort())
                .build());
        cluster.connect();
    }

    /**
     *

     * Validates that if connection is lost to a node that is using SSL authentication, that connection can be
     * re-established when the node becomes available again.
     *

     *
     * @test_category connection:ssl
     * @expected_result Connection is re-established within a sufficient amount of time after a node comes back online.
     */
    @CCMConfig(dirtiesContext = true)
    @Test(groups = "long", dataProvider = "sslImplementation", dataProviderClass = SSLTestBase.class)
    public void should_reconnect_with_ssl_on_node_up(SslImplementation sslImplementation) throws Exception {
        Cluster cluster = register(Cluster.builder()
                .addContactPoints(this.getContactPoints())
                .withPort(ccm().getBinaryPort())
                .withSSL(getSSLOptions(sslImplementation, true, true))
                .build());

        cluster.connect();

        ccm().stop(1);
        ccm().start(1);

        assertThat(cluster).host(1).comesUpWithin(TestUtils.TEST_BASE_NODE_WAIT, TimeUnit.SECONDS);
    }

    /**
     *

     * Validates that SSL connectivity can be configured via the standard javax.net.ssl System properties.
     *

     *
     * @test_category connection:ssl
     * @expected_result Connection can be established.
     */
    @Test(groups = "isolated")
    public void should_use_system_properties_with_default_ssl_options() throws Exception {
        System.setProperty("javax.net.ssl.trustStore", DEFAULT_CLIENT_TRUSTSTORE_FILE.getAbsolutePath());
        System.setProperty("javax.net.ssl.trustStorePassword", DEFAULT_CLIENT_TRUSTSTORE_PASSWORD);
        try {
            connectWithSSL();
        } finally {
            try {
                System.clearProperty("javax.net.ssl.trustStore");
                System.clearProperty("javax.net.ssl.trustStorePassword");
            } catch (SecurityException e) {
                // ok
            }
        }
    }
}


text:
require 'rubygems'
require 'pathname'
require Pathname(__FILE__).dirname.expand_path.parent + 'lib/dm-adjust'

def load_driver(name, default_uri)
  return false if ENV['ADAPTER'] != name.to_s

  lib = "do_#{name}"

  begin
    gem lib, '>=0.9.5'
    require lib
    DataMapper.setup(name, ENV["#{name.to_s.upcase}_SPEC_URI"] || default_uri)
    DataMapper::Repository.adapters[:default] =  DataMapper::Repository.adapters[name]
    # DataObjects::Sqlite3.logger = DataObjects::Logger.new(Pathname(__FILE__).dirname+'dm.log',0)
    true
  rescue Gem::LoadError => e
    warn "Could not load #{lib}: #{e}"
    false
  end
end

ENV['ADAPTER'] ||= 'sqlite3'

HAS_SQLITE3  = load_driver(:sqlite3,  'sqlite3::memory:')
HAS_MYSQL    = load_driver(:mysql,    'mysql://localhost/dm_core_test')
HAS_POSTGRES = load_driver(:postgres, 'postgres://postgres@localhost/dm_core_test')


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

		<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
		<link rel="stylesheet" type="text/stylesheet" href="style2.css" />
		<title>Adding Style</title>

Learning CSS

Zen Garden

CSS Tutorial

Color Grabber

Color Scheme Designer

Adding Style Rules

Each style block begins with a selector or a series of selectors. These selectors specify which tag or tags the style is to be applied to. After the selector(s) comes {}s. Within the {}s are one or more style rules.

Each style rule is made up of a property:value pair. The property must be one of the properties defined in CSS. You can find a list of the these properties on the CSS Reference from W3Schools.

Each property has specific values that are allowed for that property. Values come in a variety of types. Below is a table of the types of values that are possible.

Value Types

Value Type	Description	Specifics

Keyword	A specific word used exactly.

Length	A number followed immediately (no space) by two letters that specify units.	in - inches

										cm - centimeters

										em - Em-height

										ex - x-height

										mm - millimeters

										pt - point

										pc - picas

										px - pixels

Color	One of the following representations for color.
					#RRGGBB

					#RGB

					rgb(rrr.rr%, ggg.gg%, bbb.bb%)

					rgb(rrr, ggg, bbb)

					keyword

Percentage	A number followed by %. This value is computed relative to another value.

url	Uses the form url(path/filename)

Browser Style Sheets

Browsers have a style sheet. This is called the user agent style sheet. These provide the default style to be used whenever there is no other style specified. The default style rules vary depending on what browser is being used. Because of these variations some recommend that a reset style sheet be used. A reset style sheet gets rid of much of the existing style and lets the web developer start with a clean slate no matter which browser is being used.

Navigation Lists

A common way to create navigation is to use a list. But most navigation does not look like a list. To get a list to work for navigation, the styles of the ul and li tags are changed.