text:
<?php

if (!defined('CORE'))
	exit();

function profile_main()
{
	global $core, $template, $user;

	$request = db_query("
		SELECT
			login_count, last_login,
			last_password_change
		FROM user
		WHERE id_user = $user[id]
		LIMIT 1");
	while ($row = db_fetch_assoc($request))
	{
		$template['profile'] = array(
			'login_count' => $row['login_count'],
			'last_login' => empty($row['last_login']) ? 'Never' : format_time($row['last_login'], 'long'),
			'last_password_change' => empty($row['last_password_change']) ? 'Never' : format_time($row['last_password_change'], 'long'),
		);
	}
	db_free_result($request);

	if (!empty($_POST['save']))
	{
		check_session('profile');

		$values = array();
		$fields = array(
			'choose_password' => 'password',
			'verify_password' => 'password',
			'current_password' => 'password',
		);

		foreach ($fields as $field => $type)
		{
			if ($type === 'password')
				$values[$field] = !empty($_POST[$field]) ? sha1($_POST[$field]) : '';
		}

		$request = db_query("
			SELECT password
			FROM user
			WHERE id_user = $user[id]
			LIMIT 1");
		list ($current_password) = db_fetch_row($request);
		db_free_result($request);

		if ($current_password !== $values['current_password'])
			fatal_error('The password entered is not correct!');

		if ($values['choose_password'] !== $values['verify_password'])
			fatal_error('The new passwords entered do not match.');

		$changes = array();
		if ($values['choose_password'] !== '')
		{
			$changes[] = "password = '$values[verify_password]'";
			$changes[] = "last_password_change = " . time();
		}

		if (!empty($changes))
		{
			db_query("
				UPDATE user
				SET " . implode(', ', $changes) . "
				WHERE id_user = $user[id]
				LIMIT 1");
		}

		if ($values['choose_password'] !== '')
			redirect(build_url('login'));
		else
			redirect(build_url('profile'));
	}

	$template['page_title'] = 'Edit Profile';
	$core['current_template'] = 'profile_main';
}

redpajama_set_name: RedPajamaGithub


text:
package br.com.juliocnsouza.todoquest.util;

import org.junit.Assert;

/**
 *
 * @author julio
 */
public class MD5Test {

    public MD5Test() {
    }

    @org.junit.Test
    public void testCrypt() {
        String value1 = "abc123456";
        String value2 = "abc123456";
        String value3 = "abd123457";
        Assert.assertEquals( value1 , value2 );
        Assert.assertNotEquals( value1 , value3 );
        Assert.assertNotEquals( value2 , value3 );
        Assert.assertEquals( MD5.crypt( value1 ) , MD5.crypt( value2 ) );
        Assert.assertNotEquals( MD5.crypt( value1 ) , MD5.crypt( value3 ) );
        Assert.assertNotEquals( MD5.crypt( value2 ) , MD5.crypt( value3 ) );
    }

}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Returns the number of fields in a result</title>

pg_meta_data

pg_num_rows

PostgreSQL Functions

PHP Manual

pg_num_fields

(PHP 4 >= 4.2.0, PHP 5)

pg_num_fields — Returns the number of fields in a result

Description

   int pg_num_fields
    ( resource $result
   )

   pg_num_fields() returns the number of fields
   (columns) in a PostgreSQL result resource.

Note:

    This function used to be called pg_numfields().

Parameters

result

       PostgreSQL query result resource, returned by pg_query(),
       pg_query_params() or pg_execute()
       (among others).

Return Values

   The number of fields (columns) in the result. On error, -1 is returned.

Examples

Example #1 pg_num_fields() example

<?php
$result = pg_query($conn, "SELECT 1, 2");

$num = pg_num_fields($result);

echo $num . " field(s) returned.\n";
?>

The above example will output:

2 field(s) returned.

See Also

pg_num_rows() - Returns the number of rows in a result

pg_affected_rows() - Returns number of affected records (tuples)

pg_meta_data

pg_num_rows

PostgreSQL Functions

PHP Manual


text:
{
  String.prototype.endsWith.apply(undefined);
}


text:
@interface SLContent : NSObject

@property (nonatomic, retain) NSString *title;
@property (nonatomic, retain) NSString *image;
@property (nonatomic, retain) NSString *url;

@end

@class Soundlinks;

@protocol SoundlinksDelegate <NSObject>

- (void)soundlinks:(Soundlinks *)soundlinks listenContents:(NSArray *)contentArray;

@end

@interface Soundlinks : NSObject

@property (nonatomic, weak) id<SoundlinksDelegate> delegate;

+ (void)setAppID:(NSString *)appid andEventId:(NSString *)eventid;
+ (void)setDelegate:(id<SoundlinksDelegate>)delegate;
+ (void)enable;
+ (void)disable;

@end


text:
package ru.job4j.puzzle.firuges;

import java.util.Objects;

public class Cell {
    public final int x;
    public final int y;

    public Cell(int x, int y) {
        this.x = x;
        this.y = y;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        Cell cell = (Cell) o;
        return x == cell.x && y == cell.y;
    }

    @Override
    public int hashCode() {
        return Objects.hash(x, y);
    }
}


text:
var _ = require('underscore');
var LegendBaseDefModel = require('./legend-base-definition-form-model');

module.exports = LegendBaseDefModel.extend({
  defaults: _.extend({}, LegendBaseDefModel.prototype.defaults,
    {
      type: 'category'
    }
  ),

  initialize: function (attrs, opts) {
    this._titlePlaceholder = _t('editor.legend.legend-form.by-color');
    LegendBaseDefModel.prototype.initialize.call(this, attrs, opts);
  }
});


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

        <title>jQuery Colorpicker</title>

		<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/themes/ui-lightness/jquery-ui.css" rel="stylesheet" type="text/css"/>

		<link href="jquery.colorpicker.css" rel="stylesheet" type="text/css"/>

jQuery ColorPicker

Basic <input>

Basic element

All features

Localization

Websafe colors

Alternative display field

Events

Input formatting

Output formatting

Output format list

In a dialog

Modal

Any element to popup

Basic <input> example, without any options

				<input type="text" class="cp-basic" value="fe9810"/>

Basic element (<span>> example, without any options

Fully-featured example

				<input type="text" class="cp-full" value="186aa7"/>

Localized to Dutch (nl)

				<input type="text" class="cp-i18n" value="ccea73"/>

Limit to websafe colors

				<input type="text" class="cp-websafe" value="0fa7c2"/>

Alternative field class

				<input type="text" class="cp-alt" value="b762ae"/>

Background-color on outside, text color here

Events

				<input type="text" class="cp-events" value="92b64a"/>

Output formatting HSLA

				<input type="text" class="cp-format" value="918237"/>

Output format list

				You can specify a list of output formats, the first perfect match for the color is output.
				<input type="text" class="cp-name" value="a92fb4"/>

Dialog with Colorpicker popup (demonstrates z-index)

				<button id="cp-dialog-open">Open dialog</button>

					Basic <input> example, without any options: <input type="text" class="cp-basic" value="fe9810"/>

					Basic element example, without any options:

Modal (and showCancelButton, closeOnEscape, showCloseButton)

				<input type="text" class="cp-modal" value="9ba73f"/>

Input formatting

				Demonstrates the ability to parse common color formats as input.
				<input type="text" class="cp-input" value="rgb(123,42,87)"/>

Popup from any element (<em>)

				Just click on this Emphasized word to show the colorpicker.


text:
<?xml version="1.0" encoding="UTF-8"?>

<persistence version="2.0"
	xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
              http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
	<persistence-unit name="query" transaction-type="RESOURCE_LOCAL">
		<provider>org.hibernate.ejb.HibernatePersistence</provider>
		<properties>
			<!-- 自动把注解的实体加入到JPA托管环境中 -->
			<property name="hibernate.archive.autodetection" value="jar,class,hbm" />
			<!-- 调整JDBC抓取数量的大小: Statement.setFetchSize(),目前Oracle支持,但MySQL暂不支持该属性 -->
			<property name="hibernate.jdbc.fetch_size" value="15" />
			<!-- 调整JDBC批量更新数量 -->
			<property name="hibernate.jdbc.batch_size" value="20" />
			<!-- 格式化显示最终执行的SQL,当设置了show_sql属性时才生效 -->
			<property name="hibernate.format_sql" value="true" />

			<!-- TODO:使用非分布式的EHCache作为二级缓存,暂时不启用,转而使用更合适的Spring3.1的方法级缓存机制
			<property name="hibernate.cache.region.factory_class" value="org.hibernate.cache.ehcache.EhCacheRegionFactory"/>
			<property name="hibernate.cache.provider_configuration" value="/ehcache.xml"/>
			<property name="hibernate.cache.use_second_level_cache" value="true" />
			<property name="hibernate.cache.use_query_cache" value="true" />
			-->
		</properties>
	</persistence-unit>
</persistence>


text:
<?php
  //This php code is for displaying courses under a selected flowchart
  include("../connect.php");
    $flowchart_version = $_GET["flowchart_version"];
     $select_flowchart = mysql_query("SELECT * FROM flowchart_course
         	                          WHERE flowchart_version='$flowchart_version'");
 	 $list_flowchart = array();
      while($fetch_flowchart = mysql_fetch_assoc($select_flowchart)){
          $list_flowchart[] = $fetch_flowchart;
      }
      echo json_encode($list_flowchart);

?>


text:
package httpunix_test

import (
	"fmt"
	"log"
	"net"
	"net/http"
	"net/http/httputil"
	"time"

	"github.com/tv42/httpunix"
)

func Example_clientStandalone() {
	// This example shows using a customized http.Client.
	u := &httpunix.Transport{
		DialTimeout:           100 * time.Millisecond,
		RequestTimeout:        1 * time.Second,
		ResponseHeaderTimeout: 1 * time.Second,
	}
	u.RegisterLocation("myservice", "/path/to/socket")

	var client = http.Client{
		Transport: u,
	}

	resp, err := client.Get("http+unix://myservice/urlpath/as/seen/by/server")
	if err != nil {
		log.Fatal(err)
	}
	buf, err := httputil.DumpResponse(resp, true)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%s", buf)
	resp.Body.Close()
}

func Example_clientIntegrated() {
	// This example shows handling all net/http requests for the
	// http+unix URL scheme.
	u := &httpunix.Transport{
		DialTimeout:           100 * time.Millisecond,
		RequestTimeout:        1 * time.Second,
		ResponseHeaderTimeout: 1 * time.Second,
	}
	u.RegisterLocation("myservice", "/path/to/socket")

	// If you want to use http: with the same client:
	t := &http.Transport{}
	t.RegisterProtocol(httpunix.Scheme, u)
	var client = http.Client{
		Transport: t,
	}

	resp, err := client.Get("http+unix://myservice/urlpath/as/seen/by/server")
	if err != nil {
		log.Fatal(err)
	}
	buf, err := httputil.DumpResponse(resp, true)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%s", buf)
	resp.Body.Close()
}

func Example_server() {
	l, err := net.Listen("unix", "/path/to/socket")
	if err != nil {
		log.Fatal(err)
	}
	defer l.Close()

	if err := http.Serve(l, nil); err != nil {
		log.Fatal(err)
	}
}


text:
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.codeInsight.lookup.impl;

import com.intellij.application.options.CodeCompletionConfigurable;
import com.intellij.codeInsight.CodeInsightBundle;
import com.intellij.codeInsight.CodeInsightSettings;
import com.intellij.codeInsight.completion.CodeCompletionFeatures;
import com.intellij.codeInsight.completion.ShowHideIntentionIconLookupAction;
import com.intellij.codeInsight.hint.HintManagerImpl;
import com.intellij.codeInsight.lookup.LookupElement;
import com.intellij.codeInsight.lookup.LookupElementAction;
import com.intellij.featureStatistics.FeatureUsageTracker;
import com.intellij.icons.AllIcons;
import com.intellij.ide.DataManager;
import com.intellij.ide.IdeEventQueue;
import com.intellij.ide.ui.UISettings;
import com.intellij.idea.ActionsBundle;
import com.intellij.injected.editor.EditorWindow;
import com.intellij.lang.LangBundle;
import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.actionSystem.impl.ActionButton;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ModalityState;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.LogicalPosition;
import com.intellij.openapi.options.ShowSettingsUtil;
import com.intellij.openapi.project.DumbAware;
import com.intellij.openapi.project.DumbAwareAction;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.ui.ComponentUtil;
import com.intellij.ui.ExperimentalUI;
import com.intellij.ui.ScreenUtil;
import com.intellij.ui.ScrollPaneFactory;
import com.intellij.ui.components.JBLayeredPane;
import com.intellij.ui.components.JBList;
import com.intellij.ui.components.JBScrollPane;
import com.intellij.util.Alarm;
import com.intellij.util.PlatformIcons;
import com.intellij.util.ui.AbstractLayoutManager;
import com.intellij.util.ui.Advertiser;
import com.intellij.util.ui.AsyncProcessIcon;
import com.intellij.util.ui.JBUI;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import javax.swing.*;
import javax.swing.border.EmptyBorder;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import java.awt.*;
import java.awt.event.MouseEvent;
import java.util.Collection;

/**
 * @author peter
 */
class LookupUi {
  private static final Logger LOG = Logger.getInstance(LookupUi.class);

  @NotNull
  private final LookupImpl myLookup;
  private final Advertiser myAdvertiser;
  private final JBList myList;
  private final ModalityState myModalityState;
  private final Alarm myHintAlarm = new Alarm();
  private final JScrollPane myScrollPane;
  private final AsyncProcessIcon myProcessIcon = new AsyncProcessIcon("Completion progress");
  private final ActionButton myMenuButton;
  private final ActionButton myHintButton;
  private final JComponent myBottomPanel;

  private int myMaximumHeight = Integer.MAX_VALUE;
  private Boolean myPositionedAbove = null;

  LookupUi(@NotNull LookupImpl lookup, Advertiser advertiser, JBList list, boolean showBottomPanel) {
    myLookup = lookup;
    myAdvertiser = advertiser;
    myList = list;

    myProcessIcon.setVisible(false);
    myLookup.resort(false);

    MenuAction menuAction = new MenuAction();
    menuAction.add(new ChangeSortingAction());
    menuAction.add(new DelegatedAction(ActionManager.getInstance().getAction(IdeActions.ACTION_QUICK_JAVADOC)){
      @Override
      public void update(@NotNull AnActionEvent e) {
        e.getPresentation().setVisible(!CodeInsightSettings.getInstance().AUTO_POPUP_JAVADOC_INFO);
      }

      @Override
      public @NotNull ActionUpdateThread getActionUpdateThread() {
        return ActionUpdateThread.BGT;
      }
    });
    menuAction.add(new DelegatedAction(ActionManager.getInstance().getAction(IdeActions.ACTION_QUICK_IMPLEMENTATIONS)));
    menuAction.addSeparator();
    menuAction.add(new ShowCompletionSettingsAction());

    Presentation presentation = new Presentation();
    presentation.setIcon(AllIcons.Actions.More);
    presentation.putClientProperty(ActionButton.HIDE_DROPDOWN_ICON, Boolean.TRUE);

    myMenuButton = new ActionButton(menuAction, presentation, ActionPlaces.EDITOR_POPUP, ActionToolbar.NAVBAR_MINIMUM_BUTTON_SIZE);
    DataManager.registerDataProvider(myMenuButton, dataId -> {
      if (CommonDataKeys.PROJECT.is(dataId)) {
        return myLookup.getProject();
      }
      if (CommonDataKeys.EDITOR.is(dataId)) {
        return myLookup.getEditor();
      }
      return null;
    });

    AnAction hintAction = new HintAction();
    myHintButton = new ActionButton(hintAction, hintAction.getTemplatePresentation().clone(),
                                    ActionPlaces.EDITOR_POPUP, ActionToolbar.NAVBAR_MINIMUM_BUTTON_SIZE);
    myHintButton.setVisible(false);

    myBottomPanel = new JPanel(new LookupBottomLayout());
    myBottomPanel.add(myAdvertiser.getAdComponent());
    myBottomPanel.add(myProcessIcon);
    myBottomPanel.add(myHintButton);
    myBottomPanel.add(myMenuButton);

    LookupLayeredPane layeredPane = new LookupLayeredPane();
    if (showBottomPanel) {
      layeredPane.mainPanel.add(myBottomPanel, BorderLayout.SOUTH);
    }

    myScrollPane = ScrollPaneFactory.createScrollPane(lookup.getList(), true);
    myScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    ComponentUtil.putClientProperty(myScrollPane.getVerticalScrollBar(), JBScrollPane.IGNORE_SCROLLBAR_IN_INSETS, true);
    if (ExperimentalUI.isNewUI()) {
      Insets bodyInsets = LookupCellRenderer.bodyInsets();
      //noinspection UseDPIAwareBorders
      myScrollPane.setBorder(new EmptyBorder(bodyInsets.top, 0, showBottomPanel ? 0 : bodyInsets.bottom, 0));
      myBottomPanel.setBackground(JBUI.CurrentTheme.CompletionPopup.Advertiser.background());
      myBottomPanel.setBorder(JBUI.CurrentTheme.CompletionPopup.Advertiser.border());
    } else {
      myBottomPanel.setOpaque(false);
    }

    lookup.getComponent().add(layeredPane, BorderLayout.CENTER);

    layeredPane.mainPanel.add(myScrollPane, BorderLayout.CENTER);

    myModalityState = ModalityState.stateForComponent(lookup.getTopLevelEditor().getComponent());

    addListeners();

    Disposer.register(lookup, myProcessIcon);
    Disposer.register(lookup, myHintAlarm);
  }

  private void addListeners() {
    myList.addListSelectionListener(new ListSelectionListener() {
      @Override
      public void valueChanged(ListSelectionEvent e) {
        if (myLookup.isLookupDisposed()) return;

        myHintAlarm.cancelAllRequests();
        updateHint();
      }
    });

    myScrollPane.getVerticalScrollBar().addAdjustmentListener(e -> {
      if (myLookup.myUpdating || myLookup.isLookupDisposed()) return;
      myLookup.myCellRenderer.scheduleUpdateLookupWidthFromVisibleItems();
    });
  }

  private void updateHint() {
    myLookup.checkValid();
    if (myHintButton.isVisible()) {
      myHintButton.setVisible(false);
    }

    LookupElement item = myLookup.getCurrentItem();
    if (item != null && item.isValid()) {
      Collection<LookupElementAction> actions = myLookup.getActionsFor(item);
      if (!actions.isEmpty()) {
        myHintAlarm.addRequest(() -> {
          if (ShowHideIntentionIconLookupAction.shouldShowLookupHint() &&
              !((CompletionExtender)myList.getExpandableItemsHandler()).isShowing() &&
              !myProcessIcon.isVisible()) {
            myHintButton.setVisible(true);
          }
        }, 500, myModalityState);
      }
    }
  }

  void setCalculating(boolean calculating) {
    Runnable iconUpdater = () -> {
      if (calculating && myHintButton.isVisible()) {
        myHintButton.setVisible(false);
      }
      myProcessIcon.setVisible(calculating);

      ApplicationManager.getApplication().invokeLater(() -> {
        if (!calculating && !myLookup.isLookupDisposed()) {
          updateHint();
        }
      }, myModalityState);
    };

    if (calculating) {
      myProcessIcon.resume();
    } else {
      myProcessIcon.suspend();
    }
    new Alarm(myLookup).addRequest(iconUpdater, 100, myModalityState);
  }

  void refreshUi(boolean selectionVisible, boolean itemsChanged, boolean reused, boolean onExplicitAction) {
    Editor editor = myLookup.getTopLevelEditor();
    if (editor.getComponent().getRootPane() == null || editor instanceof EditorWindow && !((EditorWindow)editor).isValid()) {
      return;
    }

    if (myLookup.myResizePending || itemsChanged) {
      myMaximumHeight = Integer.MAX_VALUE;
    }
    Rectangle rectangle = calculatePosition();
    myMaximumHeight = rectangle.height;

    if (myLookup.myResizePending || itemsChanged) {
      myLookup.myResizePending = false;
      myLookup.pack();
      rectangle = calculatePosition();
    }
    HintManagerImpl.updateLocation(myLookup, editor, rectangle.getLocation());

    if (reused || selectionVisible || onExplicitAction) {
      myLookup.ensureSelectionVisible(false);
    }
  }

  boolean isPositionedAboveCaret() {
    return myPositionedAbove != null && myPositionedAbove.booleanValue();
  }

  // in layered pane coordinate system.
  Rectangle calculatePosition() {
    final JComponent lookupComponent = myLookup.getComponent();
    Dimension dim = lookupComponent.getPreferredSize();
    int lookupStart = myLookup.getLookupStart();
    Editor editor = myLookup.getTopLevelEditor();
    if (lookupStart < 0 || lookupStart > editor.getDocument().getTextLength()) {
      LOG.error(lookupStart + "; offset=" + editor.getCaretModel().getOffset() + "; element=" +
                myLookup.getPsiElement());
    }

    LogicalPosition pos = editor.offsetToLogicalPosition(lookupStart);
    Point location = editor.logicalPositionToXY(pos);
    location.y += editor.getLineHeight();
    location.x -= myLookup.myCellRenderer.getTextIndent();
    // extra check for other borders
    final Window window = ComponentUtil.getWindow(lookupComponent);
    if (window != null) {
      final Point point = SwingUtilities.convertPoint(lookupComponent, 0, 0, window);
      location.x -= point.x;
    }

    SwingUtilities.convertPointToScreen(location, editor.getContentComponent());
    final Rectangle screenRectangle = ScreenUtil.getScreenRectangle(editor.getContentComponent());

    if (!isPositionedAboveCaret()) {
      int shiftLow = screenRectangle.y + screenRectangle.height - (location.y + dim.height);
      myPositionedAbove = shiftLow < 0 && shiftLow < location.y - dim.height && location.y >= dim.height;
    }
    if (isPositionedAboveCaret()) {
      location.y -= dim.height + editor.getLineHeight();
    }

    if (!screenRectangle.contains(location)) {
      location = ScreenUtil.findNearestPointOnBorder(screenRectangle, location);
    }

    Rectangle candidate = new Rectangle(location, dim);
    ScreenUtil.cropRectangleToFitTheScreen(candidate);

    if (isPositionedAboveCaret()) {
      // need to crop as well at bottom if lookup overlaps current line
      Point caretLocation = editor.logicalPositionToXY(pos);
      SwingUtilities.convertPointToScreen(caretLocation, editor.getContentComponent());
      int offset = location.y + dim.height - caretLocation.y;
      if (offset > 0) {
        candidate.height -= offset;
      }
    }

    JRootPane rootPane = editor.getComponent().getRootPane();
    if (rootPane != null) {
      SwingUtilities.convertPointFromScreen(location, rootPane.getLayeredPane());
    }
    else {
      LOG.error("editor.disposed=" + editor.isDisposed() + "; lookup.disposed=" + myLookup.isLookupDisposed() + "; editorShowing=" + editor.getContentComponent().isShowing());
    }

    myMaximumHeight = candidate.height;
    return new Rectangle(location.x, location.y, dim.width, candidate.height);
  }

  private static class ShowCompletionSettingsAction extends AnAction implements DumbAware {
    ShowCompletionSettingsAction() {
      super(LangBundle.message("action.code.completion.settings.text"), null, AllIcons.General.Settings);
    }

    @Override
    public void actionPerformed(@NotNull AnActionEvent e) {
      ShowSettingsUtil.getInstance().showSettingsDialog(getEventProject(e), CodeCompletionConfigurable.class);
    }
  }

  private final class LookupLayeredPane extends JBLayeredPane {
    final JPanel mainPanel = new JPanel(new BorderLayout());

    private LookupLayeredPane() {
      mainPanel.setBackground(LookupCellRenderer.BACKGROUND_COLOR);
      add(mainPanel, 0, 0);

      setLayout(new AbstractLayoutManager() {
        @Override
        public Dimension preferredLayoutSize(@Nullable Container parent) {
          int maxCellWidth = myLookup.myCellRenderer.getLookupTextWidth() + myLookup.myCellRenderer.getTextIndent();
          int scrollBarWidth = myScrollPane.getVerticalScrollBar().getWidth();
          int listWidth = Math.min(scrollBarWidth + maxCellWidth, UISettings.getInstance().getMaxLookupWidth());

          Dimension bottomPanelSize = myBottomPanel.getPreferredSize();

          int panelHeight = myScrollPane.getPreferredSize().height + bottomPanelSize.height;
          int width = Math.max(listWidth, bottomPanelSize.width);
          width = Math.min(width, Registry.intValue("ide.completion.max.width"));
          int height = Math.min(panelHeight, myMaximumHeight);

          return new Dimension(width, height);
        }

        @Override
        public void layoutContainer(Container parent) {
          Dimension size = getSize();
          mainPanel.setSize(size);
          mainPanel.validate();

          if (IdeEventQueue.getInstance().getTrueCurrentEvent().getID() == MouseEvent.MOUSE_DRAGGED) {
            Dimension preferredSize = preferredLayoutSize(null);
            if (preferredSize.width != size.width) {
              UISettings.getInstance().setMaxLookupWidth(Math.max(500, size.width));
            }

            int listHeight = myList.getLastVisibleIndex() - myList.getFirstVisibleIndex() + 1;
            if (listHeight != myList.getModel().getSize() && listHeight != myList.getVisibleRowCount() && preferredSize.height != size.height) {
              UISettings.getInstance().setMaxLookupListHeight(Math.max(5, listHeight));
            }
          }

          myList.setFixedCellWidth(myScrollPane.getViewport().getWidth());
        }
      });
    }
  }

  private final class HintAction extends DumbAwareAction {
    private HintAction() {
      super(AllIcons.Actions.IntentionBulb);

      AnAction showIntentionAction = ActionManager.getInstance().getAction(IdeActions.ACTION_SHOW_INTENTION_ACTIONS);
      if (showIntentionAction != null) {
        copyShortcutFrom(showIntentionAction);
        getTemplatePresentation().setText(CodeInsightBundle.messagePointer("action.presentation.LookupUi.text"));
      }
    }

    @Override
    public void actionPerformed(@NotNull AnActionEvent e) {
      myLookup.showElementActions(e.getInputEvent());
    }
  }

  private static final class MenuAction extends DefaultActionGroup implements HintManagerImpl.ActionToIgnore {
    private MenuAction() {
      setPopup(true);
    }
  }

  private final class ChangeSortingAction extends DumbAwareAction implements HintManagerImpl.ActionToIgnore {
    private ChangeSortingAction() {
      super(ActionsBundle.messagePointer("action.ChangeSortingAction.text"));
    }

    @Override
    public void actionPerformed(@NotNull AnActionEvent e) {
      FeatureUsageTracker.getInstance().triggerFeatureUsed(CodeCompletionFeatures.EDITING_COMPLETION_CHANGE_SORTING);
      UISettings settings = UISettings.getInstance();
      settings.setSortLookupElementsLexicographically(!settings.getSortLookupElementsLexicographically());
      myLookup.resort(false);
    }

    @Override
    public void update(@NotNull AnActionEvent e) {
      e.getPresentation().setIcon(UISettings.getInstance().getSortLookupElementsLexicographically() ? PlatformIcons.CHECK_ICON : null);
    }

    @Override
    public @NotNull ActionUpdateThread getActionUpdateThread() {
      return ActionUpdateThread.EDT;
    }
  }

  private static class DelegatedAction extends DumbAwareAction implements HintManagerImpl.ActionToIgnore {
    private final AnAction delegateAction;
    private DelegatedAction(AnAction action) {
      delegateAction = action;
      getTemplatePresentation().setText(delegateAction.getTemplateText(), true);
      copyShortcutFrom(delegateAction);
    }

    @Override
    public void actionPerformed(@NotNull AnActionEvent e) {
      delegateAction.actionPerformed(e);
    }
  }

  private class LookupBottomLayout implements LayoutManager {
    @Override
    public void addLayoutComponent(String name, Component comp) {}

    @Override
    public void removeLayoutComponent(Component comp) {}

    @Override
    public Dimension preferredLayoutSize(Container parent) {
      Insets insets = parent.getInsets();
      Dimension adSize = myAdvertiser.getAdComponent().getPreferredSize();
      Dimension hintButtonSize = myHintButton.getPreferredSize();
      Dimension menuButtonSize = myMenuButton.getPreferredSize();

      return new Dimension(adSize.width + hintButtonSize.width + menuButtonSize.width + insets.left + insets.right,
                           Math.max(adSize.height, menuButtonSize.height) + insets.top + insets.bottom);
    }

    @Override
    public Dimension minimumLayoutSize(Container parent) {
      Insets insets = parent.getInsets();
      Dimension adSize = myAdvertiser.getAdComponent().getMinimumSize();
      Dimension hintButtonSize = myHintButton.getMinimumSize();
      Dimension menuButtonSize = myMenuButton.getMinimumSize();

      return new Dimension(adSize.width + hintButtonSize.width + menuButtonSize.width + insets.left + insets.right,
                           Math.max(adSize.height, menuButtonSize.height)  + insets.top + insets.bottom);
    }

    @Override
    public void layoutContainer(Container parent) {
      Insets insets = parent.getInsets();
      Dimension size = parent.getSize();
      int innerHeight = size.height - insets.top - insets.bottom;

      Dimension menuButtonSize = myMenuButton.getPreferredSize();
      int x = size.width - menuButtonSize.width - insets.right;
      int y = (innerHeight - menuButtonSize.height) / 2;

      myMenuButton.setBounds(x, y + insets.top, menuButtonSize.width, menuButtonSize.height);

      Dimension myHintButtonSize = myHintButton.getPreferredSize();
      if (myHintButton.isVisible() && !myProcessIcon.isVisible()) {
        x -= myHintButtonSize.width;
        y = (innerHeight - myHintButtonSize.height) / 2;
        myHintButton.setBounds(x, y + insets.top, myHintButtonSize.width, myHintButtonSize.height);
      }
      else if (!myHintButton.isVisible() && myProcessIcon.isVisible()) {
        Dimension myProcessIconSize = myProcessIcon.getPreferredSize();
        x -= myProcessIconSize.width;
        y = (innerHeight - myProcessIconSize.height) / 2;
        myProcessIcon.setBounds(x, y + insets.top, myProcessIconSize.width, myProcessIconSize.height);
      }
      else if (!myHintButton.isVisible() && !myProcessIcon.isVisible()) {
        x -= myHintButtonSize.width;
      }
      else {
        throw new IllegalStateException("Can't show both process icon and hint button");
      }

      Dimension adSize = myAdvertiser.getAdComponent().getPreferredSize();
      y = (innerHeight - adSize.height) / 2;
      myAdvertiser.getAdComponent().setBounds(insets.left, y + insets.top, x - insets.left, adSize.height);
    }
  }
}


text:
(function () {
  'use strict';
  angular.module('randommet.components', [
    'randommet.components.randomizers',
    'randommet.components.choosers'
  ]);

})();


text:
using System;

using Wbs.Everdigm.Database;

namespace Wbs.Everdigm.Web.main
{
    public partial class account_add : BaseAccountPage
    {
        protected override void Page_Load(object sender, EventArgs e)
        {
            base.Page_Load(sender, e);
            if (!HasSessionLose)
            {
                if (!string.IsNullOrEmpty(_key))
                {
                    hidID.Value = _key;
                    if (!IsPostBack)
                    {
                        showEdit();
                    }
                }
            }
        }

        private void showEdit()
        {
            var account = AccountInstance.Find(f => f.id == ParseInt(Utility.Decrypt(_key)));
            if (null != account)
            {
                txtCode.Value = account.Code;
                txtDepartment.Value = (int?)null == account.Department ? "" : account.TB_Department.Name;
                txtEmail.Value = account.Email;
                txtLindline.Value = account.LandlineNumber;
                txtName.Value = account.Name;
                txtPhone.Value = account.Phone;
                txtQuestion.Value = account.Question;
                txtAnswer.Disabled = !string.IsNullOrEmpty(account.Question);
                txtRole.Value = (int?)null == account.Role ? "" : account.TB_Role.Name;
                hidDepartment.Value = (int?)null == account.Department ? "" : account.Department.ToString();
                hidRole.Value = (int?)null == account.Role ? "" : account.Role.ToString();
            }
            else
            { ShowNotification("./account_list.aspx", "Error: paramenter error, cannot edit the account.", false); }
        }

        private void BuildAccountInfo(TB_Account obj)
        {
            obj.Answer = txtAnswer.Value.Trim();
            obj.Code = txtCode.Value.Trim();
            obj.Department = ParseInt(hidDepartment.Value);
            if (obj.Department < 0) {
                obj.Department = null;
                // 获取默认部门
                var dept = DepartmentInstance.Find(f => f.IsDefault == true && f.Delete == false);
                if (null != dept)
                {
                    obj.Department = dept.id;
                }
            }
            obj.Email = txtEmail.Value.Trim();
            obj.LandlineNumber = txtLindline.Value.Trim();
            obj.Name = txtName.Value.Trim();
            //新建用户时
            if (obj.id == 0)
            {
                obj.Password = Utility.MD5("123456");
            }
            obj.Phone = txtPhone.Value.Trim();
            obj.Question = txtQuestion.Value.Trim();
            obj.Role = ParseInt(hidRole.Value);
            // 默认角色
            if (obj.Role < 0)
            {
                obj.Role = (int?)null;
                var role = RoleInstance.Find(f => f.IsDefault == true && f.Delete == false);
                if (null != role) obj.Role = role.id;
            }
        }
        private void NewAccount()
        {
            var account = AccountInstance.GetObject();
            BuildAccountInfo(account);
            // check the same login code
            var chk = AccountInstance.Find(f => f.Code.Equals(account.Code));
            if (null != chk)
            {
                ShowNotification("./account_add.aspx", "The login code \"" + account.Code + "\" is exist.", false);
            }
            else
            {
                AccountInstance.Add(account);

                // 保存历史记录
                SaveHistory(new TB_AccountHistory()
                {
                    ActionId = ActionInstance.Find(f => f.Name.Equals("AddAccount")).id,
                    ObjectA = "[id=" + account.id + "] " + account.Name + ", " + account.Code
                });

                ShowNotification("./account_add.aspx", "You add a new account: " + account.Name + "(" + account.Code + ").");
            }
        }

        private void EditAccount()
        {
            var account = AccountInstance.Find(f => f.id == ParseInt(Utility.Decrypt(hidID.Value)));
            if (null != account)
            {
                BuildAccountInfo(account);
                Update(account);

                // 保存历史记录
                SaveHistory(new TB_AccountHistory
                {
                    ActionId = ActionInstance.Find(f => f.Name.Equals("EditAccount")).id,
                    ObjectA = "[id=" + account.id + "] " + account.Name + ", " + account.Code
                });

                ShowNotification("./account_list.aspx", "You changed account: " + account.Name + "(" + account.Code + ").");
            }
        }

        protected void btSave_Click(object sender, EventArgs e)
        {
            if (!HasSessionLose)
            {
                if ("" == hidID.Value)
                {
                    NewAccount();
                }
                else
                {
                    EditAccount();
                }
            }
        }
    }
}


text:
namespace blink {

namespace {

const int kVKeyProcessKey = 229;

WebFocusType focusDirectionForKey(const String& key)
{
    WebFocusType retVal = WebFocusTypeNone;
    if (key == "ArrowDown")
        retVal = WebFocusTypeDown;
    else if (key == "ArrowUp")
        retVal = WebFocusTypeUp;
    else if (key == "ArrowLeft")
        retVal = WebFocusTypeLeft;
    else if (key == "ArrowRight")
        retVal = WebFocusTypeRight;
    return retVal;
}

} // namespace

KeyboardEventManager::KeyboardEventManager(
    LocalFrame* frame, ScrollManager* scrollManager)
: m_frame(frame)
, m_scrollManager(scrollManager)
{
}

KeyboardEventManager::~KeyboardEventManager()
{
}

bool KeyboardEventManager::handleAccessKey(const PlatformKeyboardEvent& evt)
{
    // FIXME: Ignoring the state of Shift key is what neither IE nor Firefox do.
    // IE matches lower and upper case access keys regardless of Shift key state - but if both upper and
    // lower case variants are present in a document, the correct element is matched based on Shift key state.
    // Firefox only matches an access key if Shift is not pressed, and does that case-insensitively.
    DCHECK(!(PlatformKeyboardEvent::accessKeyModifiers() & PlatformEvent::ShiftKey));
    if ((evt.getModifiers() & (PlatformEvent::KeyModifiers & ~PlatformEvent::ShiftKey)) != PlatformKeyboardEvent::accessKeyModifiers())
        return false;
    String key = evt.unmodifiedText();
    Element* elem = m_frame->document()->getElementByAccessKey(key.lower());
    if (!elem)
        return false;
    elem->accessKeyAction(false);
    return true;
}

WebInputEventResult KeyboardEventManager::keyEvent(
    const PlatformKeyboardEvent& initialKeyEvent)
{
    m_frame->chromeClient().clearToolTip();

    if (initialKeyEvent.windowsVirtualKeyCode() == VK_CAPITAL)
        capsLockStateMayHaveChanged();

#if OS(WIN)
    if (m_scrollManager->panScrollInProgress()) {
        // If a key is pressed while the panScroll is in progress then we want to stop
        if (initialKeyEvent.type() == PlatformEvent::KeyDown || initialKeyEvent.type() == PlatformEvent::RawKeyDown)
            m_scrollManager->stopAutoscroll();

        // If we were in panscroll mode, we swallow the key event
        return WebInputEventResult::HandledSuppressed;
    }
#endif

    // Check for cases where we are too early for events -- possible unmatched key up
    // from pressing return in the location bar.
    Node* node = eventTargetNodeForDocument(m_frame->document());
    if (!node)
        return WebInputEventResult::NotHandled;

    UserGestureIndicator gestureIndicator(DefinitelyProcessingUserGesture);

    // In IE, access keys are special, they are handled after default keydown processing, but cannot be canceled - this is hard to match.
    // On Mac OS X, we process them before dispatching keydown, as the default keydown handler implements Emacs key bindings, which may conflict
    // with access keys. Then we dispatch keydown, but suppress its default handling.
    // On Windows, WebKit explicitly calls handleAccessKey() instead of dispatching a keypress event for WM_SYSCHAR messages.
    // Other platforms currently match either Mac or Windows behavior, depending on whether they send combined KeyDown events.
    bool matchedAnAccessKey = false;
    if (initialKeyEvent.type() == PlatformEvent::KeyDown)
        matchedAnAccessKey = handleAccessKey(initialKeyEvent);

    // FIXME: it would be fair to let an input method handle KeyUp events before DOM dispatch.
    if (initialKeyEvent.type() == PlatformEvent::KeyUp || initialKeyEvent.type() == PlatformEvent::Char) {
        KeyboardEvent* domEvent = KeyboardEvent::create(initialKeyEvent, m_frame->document()->domWindow());

        return EventHandler::toWebInputEventResult(node->dispatchEvent(domEvent));
    }

    PlatformKeyboardEvent keyDownEvent = initialKeyEvent;
    if (keyDownEvent.type() != PlatformEvent::RawKeyDown)
        keyDownEvent.disambiguateKeyDownEvent(PlatformEvent::RawKeyDown);
    KeyboardEvent* keydown = KeyboardEvent::create(keyDownEvent, m_frame->document()->domWindow());
    if (matchedAnAccessKey)
        keydown->setDefaultPrevented(true);
    keydown->setTarget(node);

    DispatchEventResult dispatchResult = node->dispatchEvent(keydown);
    if (dispatchResult != DispatchEventResult::NotCanceled)
        return EventHandler::toWebInputEventResult(dispatchResult);
    // If frame changed as a result of keydown dispatch, then return early to avoid sending a subsequent keypress message to the new frame.
    bool changedFocusedFrame = m_frame->page() && m_frame != m_frame->page()->focusController().focusedOrMainFrame();
    if (changedFocusedFrame)
        return WebInputEventResult::HandledSystem;

    if (initialKeyEvent.type() == PlatformEvent::RawKeyDown)
        return WebInputEventResult::NotHandled;

    // Focus may have changed during keydown handling, so refetch node.
    // But if we are dispatching a fake backward compatibility keypress, then we pretend that the keypress happened on the original node.
    node = eventTargetNodeForDocument(m_frame->document());
    if (!node)
        return WebInputEventResult::NotHandled;

    PlatformKeyboardEvent keyPressEvent = initialKeyEvent;
    keyPressEvent.disambiguateKeyDownEvent(PlatformEvent::Char);
    if (keyPressEvent.text().isEmpty())
        return WebInputEventResult::NotHandled;
    KeyboardEvent* keypress = KeyboardEvent::create(keyPressEvent, m_frame->document()->domWindow());
    keypress->setTarget(node);
    return EventHandler::toWebInputEventResult(node->dispatchEvent(keypress));
}

void KeyboardEventManager::capsLockStateMayHaveChanged()
{
    if (Element* element = m_frame->document()->focusedElement()) {
        if (LayoutObject* r = element->layoutObject()) {
            if (r->isTextField())
                toLayoutTextControlSingleLine(r)->capsLockStateMayHaveChanged();
        }
    }
}

void KeyboardEventManager::defaultKeyboardEventHandler(
    KeyboardEvent* event, Node* possibleFocusedNode)
{
    if (event->type() == EventTypeNames::keydown) {
        m_frame->editor().handleKeyboardEvent(event);
        if (event->defaultHandled())
            return;

        // Do not perform the default action when inside a IME composition context.
        // TODO(dtapuska): Replace this with isComposing support. crbug.com/625686
        if (event->keyCode() == kVKeyProcessKey)
            return;
        if (event->key() == "Tab") {
            defaultTabEventHandler(event);
        } else if (event->key() == "Backspace") {
            defaultBackspaceEventHandler(event);
        } else if (event->key() == "Escape") {
            defaultEscapeEventHandler(event);
        } else {
            WebFocusType type = focusDirectionForKey(event->key());
            if (type != WebFocusTypeNone)
                defaultArrowEventHandler(type, event);
        }
    }
    if (event->type() == EventTypeNames::keypress) {
        m_frame->editor().handleKeyboardEvent(event);
        if (event->defaultHandled())
            return;
        if (event->charCode() == ' ')
            defaultSpaceEventHandler(event, possibleFocusedNode);
    }
}

void KeyboardEventManager::defaultSpaceEventHandler(
    KeyboardEvent* event, Node* possibleFocusedNode)
{
    DCHECK_EQ(event->type(), EventTypeNames::keypress);

    if (event->ctrlKey() || event->metaKey() || event->altKey())
        return;

    ScrollDirection direction = event->shiftKey() ? ScrollBlockDirectionBackward : ScrollBlockDirectionForward;

    // FIXME: enable scroll customization in this case. See crbug.com/410974.
    if (m_scrollManager->logicalScroll(direction, ScrollByPage, nullptr, possibleFocusedNode)) {
        event->setDefaultHandled();
        return;
    }
}

void KeyboardEventManager::defaultBackspaceEventHandler(KeyboardEvent* event)
{
    DCHECK_EQ(event->type(), EventTypeNames::keydown);

    if (!RuntimeEnabledFeatures::backspaceDefaultHandlerEnabled())
        return;

    if (event->ctrlKey() || event->metaKey() || event->altKey())
        return;

    if (!m_frame->editor().behavior().shouldNavigateBackOnBackspace())
        return;
    UseCounter::count(m_frame->document(), UseCounter::BackspaceNavigatedBack);
    if (m_frame->page()->chromeClient().hadFormInteraction())
        UseCounter::count(m_frame->document(), UseCounter::BackspaceNavigatedBackAfterFormInteraction);
    bool handledEvent = m_frame->loader().client()->navigateBackForward(event->shiftKey() ? 1 : -1);
    if (handledEvent)
        event->setDefaultHandled();
}

void KeyboardEventManager::defaultArrowEventHandler(WebFocusType focusType, KeyboardEvent* event)
{
    DCHECK_EQ(event->type(), EventTypeNames::keydown);

    if (event->ctrlKey() || event->metaKey() || event->shiftKey())
        return;

    Page* page = m_frame->page();
    if (!page)
        return;

    if (!isSpatialNavigationEnabled(m_frame))
        return;

    // Arrows and other possible directional navigation keys can be used in design
    // mode editing.
    if (m_frame->document()->inDesignMode())
        return;

    if (page->focusController().advanceFocus(focusType))
        event->setDefaultHandled();
}

void KeyboardEventManager::defaultTabEventHandler(KeyboardEvent* event)
{
    DCHECK_EQ(event->type(), EventTypeNames::keydown);

    // We should only advance focus on tabs if no special modifier keys are held down.
    if (event->ctrlKey() || event->metaKey())
        return;

#if !OS(MACOSX)
    // Option-Tab is a shortcut based on a system-wide preference on Mac but
    // should be ignored on all other platforms.
    if (event->altKey())
        return;
#endif

    Page* page = m_frame->page();
    if (!page)
        return;
    if (!page->tabKeyCyclesThroughElements())
        return;

    WebFocusType focusType = event->shiftKey() ? WebFocusTypeBackward : WebFocusTypeForward;

    // Tabs can be used in design mode editing.
    if (m_frame->document()->inDesignMode())
        return;

    if (page->focusController().advanceFocus(focusType, InputDeviceCapabilities::doesntFireTouchEventsSourceCapabilities()))
        event->setDefaultHandled();
}

void KeyboardEventManager::defaultEscapeEventHandler(KeyboardEvent* event)
{
    if (HTMLDialogElement* dialog = m_frame->document()->activeModalDialog())
        dialog->dispatchEvent(Event::createCancelable(EventTypeNames::cancel));
}

DEFINE_TRACE(KeyboardEventManager)
{
    visitor->trace(m_frame);
}

} // namespace blink


text:
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="../../standard_stylesheet.xsl"?>
<document location="../../">

    <title>GP project tools - jindent</title>

AB/CO/AP

    <author firstname="Eric" lastname="Roux" ccid="13644"/>
    <reviewers></reviewers>
    <currentVersion></currentVersion>
    <history></history>

		<description>

        Jindent Gold Integration for Netbeans

  		</description>

</document>


text:
package org.wfe.core.model.workflow;

import org.wfe.commons.base.IIdentificable;
import org.wfe.commons.base.INameable;

/**
 * The action interface.
 *
 * @author daviz
 *
 */
public interface IAction
extends IIdentificable<Long>,INameable{

	public void setMandatory(boolean mandatory);

	public boolean isMandatory();

	void setState(IState s);

	IState getState();
}


text:
export function getOffsetLeft(el) {
  var rect = el.getBoundingClientRect(),
      left = rect.left + document.body.scrollLeft;
  return Math.round(left);
}


text:
package javax.enterprise.inject.spi;

import javax.enterprise.context.spi.CreationalContext;

/**
 * Helper class for manually maintaining CDI created instances
 * which are not managed by the CDI container.
 *
 * Be aware that instances created that way are <i>not</i>
 * managed by the CDI container and thus need to be
 * cleaned up manually to not create memory leaks!.
 *
 * Normal code shall use {@link javax.enterprise.inject.Instance} if possible.
 *
 * The reason for using UnmanagedInstance is for
 * @Dependent scoped instances which should not pollute the
 * {@link javax.enterprise.context.spi.CreationalContext} of the containing instance.
 *
 * Note that the methods of UnmanagedInstance needs to be called
 * in a well defined order.
 *
 * Please note that this classes are not thread safe!
 *
 * @param <T> the type of the CDI instance to create
 * @since 1.1
 */
public class Unmanaged<T>
{
    private BeanManager beanManager;
    private InjectionTarget<T> injectionTarget;

    public Unmanaged(Class<T> clazz)
    {
        this(CDI.current().getBeanManager(), clazz);
    }

    public Unmanaged(BeanManager beanManager, java.lang.Class<T> clazz)
    {
        this.beanManager = beanManager;
        AnnotatedType<T> annotatedType = beanManager.createAnnotatedType(clazz);
        injectionTarget =  beanManager.createInjectionTarget(annotatedType);
    }

    public UnmanagedInstance<T> newInstance()
    {
        return new UnmanagedInstance<>(beanManager, injectionTarget);
    }

    /**
     * This basically delegates to the {@link javax.enterprise.inject.spi.InjectionTarget}
     * interface
     * @param <T> the type of the CDI instance to create
     */
    public static class UnmanagedInstance<T>
    {
        private BeanManager beanManager;
        private InjectionTarget<T> injectionTarget;

        private CreationalContext<T> creationalContext;
        private T instance;

        private boolean injected;
        private boolean disposed;

        private UnmanagedInstance(BeanManager beanManager, InjectionTarget<T> injectionTarget)
        {
            this.injectionTarget = injectionTarget;
            this.beanManager = beanManager;
        }

        /**
         * Create the CDI instance itself. This internally just calls
         * {@link javax.enterprise.inject.spi.InjectionTarget#produce(javax.enterprise.context.spi.CreationalContext)}
         * and performs a few checks upfront.
         *
         * @throws java.lang.IllegalStateException if the instance already got created
         * @throws java.lang.IllegalStateException if the instance already got disposed
         */
        public UnmanagedInstance<T> produce()
        {
            if (creationalContext != null)
            {
                throw new IllegalStateException("UnmanagedInstance is already produced");
            }
            if (disposed)
            {
                throw new IllegalStateException("UnmanagedInstance is already disposed");
            }

            creationalContext = beanManager.createCreationalContext(null);
            instance = injectionTarget.produce(creationalContext);

            return this;
        }

        /**
         * Fill @inject field, constructor and methods.
         *
         * @throws java.lang.IllegalStateException if the instance was not yet created
         * @throws java.lang.IllegalStateException if the instance already got injected
         * @throws java.lang.IllegalStateException if the instance already got disposed
         * @see javax.enterprise.inject.spi.InjectionTarget#inject(Object, javax.enterprise.context.spi.CreationalContext)
         */
        public UnmanagedInstance<T> inject()
        {
            basicCheck();
            if (injected)
            {
                throw new IllegalStateException("UnmanagedInstance is already injected");
            }

            injectionTarget.inject(instance, creationalContext);
            injected = true;

            return this;
        }

        /**
         * Invoke any @PostConstruct methods.
         * @see javax.enterprise.inject.spi.InjectionTarget#postConstruct(Object)
         */
        public UnmanagedInstance<T> postConstruct()
        {
            basicCheck();

            injectionTarget.postConstruct(instance);

            return this;
        }

        /**
         * This method should only get called after the
         * CDI instance got properly produced and initialized
         * via
         * {@link #produce()}
         * {@link #inject()}
         * {@link #postConstruct()}
         *
         * @return the filled cdi instance
         */
        public T get()
        {
            basicCheck();

            return instance;
        }

        /**
         * Invoke any @PreDestroy annotated methods
         * and interceptors of the given CDI instance.
         */
        public UnmanagedInstance<T> preDestroy()
        {
            basicCheck();

            injectionTarget.preDestroy(instance);

            return this;
        }

        /**
         * Dispose the CDI instance. One should call {@link #preDestroy()} before
         * this method.
         * @see javax.enterprise.inject.spi.InjectionTarget#dispose(Object)
         */
        public UnmanagedInstance<T> dispose()
        {
            basicCheck();

            injectionTarget.dispose(instance);
            creationalContext.release();

            disposed = true;
            return this;
        }

        /**
         * Check whether the UnmanagedInstance is already initialized and not yet disposed.
         */
        private void basicCheck()
        {
            if (creationalContext == null)
            {
                throw new IllegalStateException("UnmanagedInstance is not yet initialized. Invoke #produce() first!");
            }
            if (disposed)
            {
                throw new IllegalStateException("UnmanagedInstance is already disposed");
            }
        }
    }

}


text:
Integrate your chat system of choice with Discourse.

For more information, please see: https://meta.discourse.org/t/chatroom-integration-plugin-discourse-chat-integration/66522


text:
/*
Navicat MySQL Data Transfer

Source Server         : WorkPC
Source Server Version : 50617
Source Host           : localhost:3306
Source Database       : conforg_db

Target Server Type    : MYSQL
Target Server Version : 50617
File Encoding         : 65001

Date: 2015-01-14 11:05:00
*/

SET FOREIGN_KEY_CHECKS=0;

-- ----------------------------
-- Table structure for conference_entertainment
-- ----------------------------
DROP TABLE IF EXISTS `conference_entertainment`;
CREATE TABLE `conference_entertainment` (
  `conference_entertainment_id` int(11) NOT NULL AUTO_INCREMENT,
  `conf_id` int(11) NOT NULL,
  `entertainment_id` int(11) NOT NULL,
  `remarks` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL,
  `created_by` int(11) NOT NULL,
  `modified_by` int(11) DEFAULT NULL,
  `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` datetime DEFAULT NULL,
  PRIMARY KEY (`conference_entertainment_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;


text:
<?php

namespace ArvPayolutionApi\Api;

/**
 * Interface ClientContract
 */
interface ClientContract
{
    /**
     * @param string $body
     *
     * @return string
     */
    public function doRequest($body);

    /**
     * @param string $method
     */
    public function setMethod($method);

    /**
     * @param string $url
     */
    public function setEndpointUrl($url);

    /**
     * @param string $key
     * @param string $value
     */
    public function addHeader($key, $value);
}