text:
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');

/*********************************************************************************

 * Description:  Defines the Spanish language pack for the base application.
 * Portions created by REDK Ingeniería del Software S.L..
 * All Rights Reserved.
 * Contributor(s): REDK Software Engineering (www.redk.net)
 ********************************************************************************/

$mod_strings = array (
  'LBL_MODULE_NAME' => 'Ventas',
  'LBL_MODULE_TITLE' => 'Ventas: Inicio',
  'LBL_SEARCH_FORM_TITLE' => 'Búsqueda de Ventas',
  'LBL_VIEW_FORM_TITLE' => 'Vista de Ventas',
  'LBL_LIST_FORM_TITLE' => 'Lista de Ventas',
  'LBL_SALE_NAME' => 'Nombre de Venta:',
  'LBL_SALE' => 'Venta:',
  'LBL_NAME' => 'Nombre de Venta',
  'LBL_LIST_SALE_NAME' => 'Nombre',
  'LBL_LIST_ACCOUNT_NAME' => 'Nombre de Cuenta',
  'LBL_LIST_AMOUNT' => 'Cantidad',
  'LBL_LIST_DATE_CLOSED' => 'Cierre',
  'LBL_LIST_SALE_STAGE' => 'Etapa de Ventas',
  'LBL_ACCOUNT_ID' => 'ID de Cuenta',
  'LBL_CURRENCY_ID' => 'ID de Moneda',
  'db_sales_stage' => NULL,
  'db_name' => NULL,
  'db_amount' => NULL,
  'db_date_closed' => NULL,
  'UPDATE' => 'Venta - Actualización de Moneda',
  'UPDATE_DOLLARAMOUNTS' => 'Actualizar Cantidades en Dólares EEUU',
  'UPDATE_VERIFY' => 'Verificar Cantidades',
  'UPDATE_VERIFY_TXT' => 'Verifica que los valores de las cantidades en las ventas son números decimales válidos con sólo caracteres numéricos (0-9) y decimales(.)',
  'UPDATE_FIX' => 'Corregir Cantidades',
  'UPDATE_FIX_TXT' => 'Intenta corregir cualquier cantidad no válida creando un número decimal válido a partir de la cantidad actual. Antes realiza una copia de seguridad de todas las cantidades modificadas en el campo de base de datos amount_backup. Si tras la correción detecta problemas, no vuelva a realizar esta operación sin restaurar los valores previos desde la copia de seguridad ya que si no sobrescribirá la copia de seguridad con nuevos datos no válidos.',
  'UPDATE_DOLLARAMOUNTS_TXT' => 'Actualiza las cantidades en Dólares EEUU para las ventas basadas en el conjunto actual de cambios de moneda. Este valor se usa para calcular gráficas y vistas de listas de cantidades monetarias.',
  'UPDATE_CREATE_CURRENCY' => 'Creando Nueva Moneda:',
  'UPDATE_VERIFY_FAIL' => 'Fallo de Verificación de Registro:',
  'UPDATE_VERIFY_CURAMOUNT' => 'Moneda Actual:',
  'UPDATE_VERIFY_FIX' => 'La Corrección daría',
  'UPDATE_INCLUDE_CLOSE' => 'Registros Cerrados Incluidos',
  'UPDATE_VERIFY_NEWAMOUNT' => 'Nueva Cantidad:',
  'UPDATE_VERIFY_NEWCURRENCY' => 'Nueva Moneda:',
  'UPDATE_DONE' => 'Hecho',
  'UPDATE_BUG_COUNT' => 'Problemas Detectados cuya Resolución se ha Intentado:',
  'UPDATE_BUGFOUND_COUNT' => 'Problemas Detectados:',
  'UPDATE_COUNT' => 'Registros Actualizados:',
  'UPDATE_RESTORE_COUNT' => 'Registros con Cantidades Restauradas:',
  'UPDATE_RESTORE' => 'Restaurar Cantidades',
  'UPDATE_RESTORE_TXT' => 'Restaura los valores de las cantidades desde la copia de seguridad creada durante la corrección.',
  'UPDATE_FAIL' => 'No ha podido actualizarse -',
  'UPDATE_NULL_VALUE' => 'La cantidad es NULL, estableciéndola a 0 -',
  'UPDATE_MERGE' => 'Unificar Monedas',
  'UPDATE_MERGE_TXT' => 'Unifica múltiples monedas en una única moneda. Si detecta que hay múltiples registros de tipo moneda para la misma moneda, puede unificarlas. Esto también unificará las monedas para el resto de módulos.',
  'LBL_ACCOUNT_NAME' => 'Nombre de Cuenta:',
  'LBL_AMOUNT' => 'Cantidad:',
  'LBL_AMOUNT_USDOLLAR' => 'Cantidad en Dólares EEUU:',
  'LBL_CURRENCY' => 'Moneda:',
  'LBL_DATE_CLOSED' => 'Fecha de Cierre Prevista:',
  'LBL_TYPE' => 'Tipo:',
  'LBL_CAMPAIGN' => 'Campaña:',
  'LBL_LEADS_SUBPANEL_TITLE' => 'Clientes Potenciales',
  'LBL_PROJECTS_SUBPANEL_TITLE' => 'Proyectos',
  'LBL_NEXT_STEP' => 'Próximo Paso:',
  'LBL_LEAD_SOURCE' => 'Toma de Contacto:',
  'LBL_SALES_STAGE' => 'Etapa de Ventas:',
  'LBL_PROBABILITY' => 'Probabilidad (%):',
  'LBL_DESCRIPTION' => 'Descripción:',
  'LBL_DUPLICATE' => 'Posible Venta Duplicada',
  'MSG_DUPLICATE' => 'El registro para la venta que va a crear podría ser un duplicado de otro registro de venta existente. Los registros de venta con nombres similares se listan a continuación.<br>Haga clic en Guardar para continuar con la creación de esta venta, o en Cancelar para volver al módulo sin crear la venta.',
  'LBL_NEW_FORM_TITLE' => 'Nueva Venta',
  'LNK_NEW_SALE' => 'Nueva Venta',
  'LNK_SALE_LIST' => 'Venta',
  'ERR_DELETE_RECORD' => 'Debe de especificar un número de registro para eliminar la venta.',
  'LBL_TOP_SALES' => 'Mis Principales Ventas Abiertas',
  'NTC_REMOVE_OPP_CONFIRMATION' => '¿Está seguro de que desea eliminar este contacto de la venta?',
  'SALE_REMOVE_PROJECT_CONFIRM' => '¿Está seguro de que desea eliminar esta venta del proyecto?',
  'LBL_DEFAULT_SUBPANEL_TITLE' => 'Venta',
  'LBL_ACTIVITIES_SUBPANEL_TITLE' => 'Actividades',
  'LBL_HISTORY_SUBPANEL_TITLE' => 'Historial',
  'LBL_RAW_AMOUNT' => 'Importe Bruto',
  'LBL_CONTACTS_SUBPANEL_TITLE' => 'Contactos',
  'LBL_ASSIGNED_TO_NAME' => 'Usuario:',
  'LBL_LIST_ASSIGNED_TO_NAME' => 'Usuario Asignado',
  'LBL_MY_CLOSED_SALES' => 'Mis Ventas Cerradas',
  'LBL_TOTAL_SALES' => 'Ventas Totales',
  'LBL_CLOSED_WON_SALES' => 'Ventas Ganadas',
  'LBL_ASSIGNED_TO_ID' => 'Asignada a ID',
  'LBL_CREATED_ID' => 'Creada por ID',
  'LBL_MODIFIED_ID' => 'Modificada por ID',
  'LBL_MODIFIED_NAME' => 'Modificada por Usuario',
  'LBL_SALE_INFORMATION' => 'Información sobre la Venta',
  'LBL_CURRENCY_NAME' => 'Nombre de Moneda',
  'LBL_CURRENCY_SYMBOL' => 'Símbolo de Moneda',
  'LBL_EDIT_BUTTON' => 'Editar',
  'LBL_REMOVE' => 'Quitar',
);


text:
package edu.brown.cs.pianoHeroDatabase;

import java.io.IOException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Statement;

import edu.brown.cs.pianoHero.Song;
import edu.brown.cs.pianoHero.SongScore;

/**
 * This class creates a database for PianoHero
 *
 * @author valentin
 */
public class PianoHeroSQLCreate {

  private Connection conn;

  /**
   * Constructor for PianoHeroSQLCreate
   *
   * @param db
   *          - String: the path to the sqlite3 database.
   * @throws ClassNotFoundException
   *           - if there is no class found JDBC.
   * @throws SQLException
   *           - if there is an exception creating the tables.
   */
  public PianoHeroSQLCreate(String db) throws ClassNotFoundException,
      SQLException {
    // Load the driver class
    Class.forName("org.sqlite.JDBC");
    String urlToDB = "jdbc:sqlite:" + db;

    // Set up a connection to the db
    conn = DriverManager.getConnection(urlToDB);

    // If we use these lines we overwrite our database, which we don't always
    // want to do

    //
  }

  public void createSchema() throws ClassNotFoundException,
  SQLException {
    // These delete the tables if they already exist
    Statement stat = conn.createStatement();
    stat.execute("DROP TABLE IF EXISTS Song");
    stat.execute("DROP TABLE IF EXISTS Score");
    stat.close();

    // schema to create a table for scores
    String schema = "CREATE TABLE Score (songId INTEGER, username  TEXT, scoreValue INTEGER);";

    buildTable(schema);

    // schema to create a table for songs
    String schema2 = "CREATE TABLE Song (id INTEGER, songName TEXT, songFile  TEXT,"
        + "songImage TEXT, songKeys TEXT, songArtist TEXT, songLength INTEGER);";

    buildTable(schema2);
  }

  /**
   * Adds a song the the sql database
   *
   * @param song
   *          : Song, the song to fill
   * @throws IOException
   *           : if there is an error writing on the file.
   * @throws SQLException
   *           : if there is an error with the query.
   */
  public void fillSong(Song song) {
    /*
     * prepares an all purpose insert statement for saving songs.
     */
    String query = "INSERT INTO song VALUES (?,?,?,?,?,?,?)";

    try (PreparedStatement ps = conn.prepareStatement(query)) {

      ps.setInt(1, song.get_id());
      ps.setString(2, song.get_title());
      ps.setString(3, song.get_mp3Path());
      ps.setString(4, song.get_imagePath());

      ps.setString(5, song.get_keyStrokesPath());
      ps.setString(6, song.get_artistName());
      ps.setInt(7, song.get_length());

      // PianoHeroFileHandler.saveSongKeystrokes(keyStrokes, songId)
      // java.sql.Array keys = conn.createArrayOf("VARCHAR",
      // song.get_keyStrokes());
      // ps.setArray(5, keys);

      ps.executeUpdate();
    } catch (SQLException e) {
      e.printStackTrace();
      System.err.println("ERROR: error saving song to database");
    }

  }

  /**
   * Adds a score to the database.
   *
   * @param score
   *          : SongScore to add.
   * @throws IOException
   *           : if there is an error writing to the file.
   * @throws SQLException
   *           : if there is an error querying.
   */
  public void fillScore(SongScore score) {
    /*
     * prepare an all purpose insert statement; note the use of question marks.
     * Each question mark corresponds to an attribute. Essentially we are
     * building a tuple to insert into the table. This allows us to use the Same
     * PreparedStatement without having to create a new one for each insertion.
     */
    System.out.println("fillScore");
    String query = "INSERT INTO score VALUES (?,?,?)";

    try (PreparedStatement ps = conn.prepareStatement(query)) {
      ps.setInt(1, score.getSongID());
      ps.setString(2, score.getUserName());
      ps.setInt(3, score.getScore());

      ps.executeUpdate();
      System.out.println("executed");
    } catch (SQLException e) {
      System.err.println("ERROR: couldn't save song to database");
    }

  }

  /**
   * Creates a new table according to the schema
   *
   * @param schema
   *          : String the schema for PianoHero tables.
   * @throws SQLException
   *           : if there is an error executing the updates.
   */
  private void buildTable(String schema) throws SQLException {
    // PreparedStatement to execute the command in
    // the argument schema. Since it will build a table, we do
    // not care about the results.

    PreparedStatement prep;
    prep = conn.prepareStatement(schema);
    prep.executeUpdate();

    prep.close();
  }

  /**
   * Closes any associated resources with the table
   *
   * @throws SQLException
   *           : if there is an error closing the database.
   */
  public void close() throws SQLException {
    conn.close();
  }
}

redpajama_set_name: RedPajamaGithub


text:
package com.esri.gpt.control.identity;
import java.util.logging.Level;

import com.esri.gpt.control.ResourceKeys;
import com.esri.gpt.framework.context.ApplicationConfiguration;
import com.esri.gpt.framework.context.RequestContext;
import com.esri.gpt.framework.jsf.BaseActionListener;
import com.esri.gpt.framework.jsf.MessageBroker;
import com.esri.gpt.framework.mail.FeedbackMessage;
import com.esri.gpt.framework.mail.MailRequest;
import com.esri.gpt.framework.security.codec.PC1_Encryptor;
import com.esri.gpt.framework.security.credentials.ChangePasswordCriteria;
import com.esri.gpt.framework.security.credentials.CredentialsDeniedException;
import com.esri.gpt.framework.security.credentials.EmailPolicyException;
import com.esri.gpt.framework.security.credentials.PasswordConfirmationException;
import com.esri.gpt.framework.security.credentials.PasswordPolicyException;
import com.esri.gpt.framework.security.credentials.RecoverPasswordCriteria;
import com.esri.gpt.framework.security.credentials.UsernamePasswordCredentials;
import com.esri.gpt.framework.security.credentials.UsernamePolicyException;
import com.esri.gpt.framework.security.identity.IdentityAdapter;
import com.esri.gpt.framework.security.identity.IdentityConfiguration;
import com.esri.gpt.framework.security.identity.IdentitySupport;
import com.esri.gpt.framework.security.identity.NotAuthorizedException;
import com.esri.gpt.framework.security.principal.User;
import com.esri.gpt.framework.security.principal.UserAttributeMap;
import com.esri.gpt.framework.util.Val;

import javax.faces.component.UIComponent;
import javax.faces.event.AbortProcessingException;
import javax.faces.event.ActionEvent;

/**
 * Handles actions associated with user self care.
 *

 * The action executed is based upon a supplied "command" attribute
 * associated with the UIComponent that triggers the processAction
 * event. Command values:

 *
changePassword - executes a password change

 *
recoverPassword - recovers a forgotten password

 *
registerUser - registers a user

 *
sendFeedback - sends a feedback message

 *
updateProfile - executes a user profile update

 */
public class SelfCareController extends BaseActionListener {

// class variables =============================================================

// instance variables ==========================================================
private UserAttributeMap        _activeUserAttributes = null;
private ChangePasswordCriteria  _changePasswordCriteria;
private FeedbackMessage         _feedbackMessage;
private HasAttributeMap         _hasAttributeMap = null;
private User                    _newUser;
private RecoverPasswordCriteria _recoverPasswordCriteria;

// constructors ================================================================

/** Default constructor. */
public SelfCareController() {}

// properties ==================================================================

/**
 * Gets the active user profile attributes.
 *

 * This method is intended for use from a JSP page only.
 * @return the active user profile attributes
 */
public UserAttributeMap getActiveUserAttributes() {
  if (_activeUserAttributes == null) {
    RequestContext rc = extractRequestContext();
    User user = rc.getUser();
    if (user.getAuthenticationStatus().getWasAuthenticated()) {
      _activeUserAttributes = new UserAttributeMap(user.getProfile());

      // attempt to reload the user's profile
      IdentityAdapter idAdapter = rc.newIdentityAdapter();
      User userUpdate = new User();
      userUpdate.setKey(user.getKey());
      userUpdate.setLocalID(user.getLocalID());
      userUpdate.setDistinguishedName(user.getDistinguishedName());
      userUpdate.setProfile(_activeUserAttributes);
      try {
        idAdapter.readUserProfile(userUpdate);
      } catch (Throwable t) {
        getLogger().log(Level.SEVERE,"Error reading user profile.",t);
      }
    } else {
      _activeUserAttributes = getNewUser().getProfile();
    }
  }
  return _activeUserAttributes;
}

/**
 * Gets the active username.
 *
This is for display only.
 * @return the active username
 */
public String getActiveUsername() {
  return extractRequestContext().getUser().getProfile().getUsername();
}
/**
 * Setter for the active username.
 *
This is for display only, the set is ignored
 * @param ignored
 */
public void setActiveUsername(String ignored) {}

/**
 * Gets the change password criteria.
 * @return the change password criteria
 */
public ChangePasswordCriteria getChangePasswordCriteria() {
  if (_changePasswordCriteria == null) {
    _changePasswordCriteria = new ChangePasswordCriteria();
  }
  return _changePasswordCriteria;
}

/**
 * Gets the message associated with user feedback.
 * @return the feedback message
 */
public FeedbackMessage getFeedbackMessage() {
  if (_feedbackMessage == null) {
    RequestContext context = extractRequestContext();
    _feedbackMessage = new FeedbackMessage();
    //_feedbackMessage.setFromName(context.getUser().getName());
    _feedbackMessage.setFromAddress(context.getUser().getProfile().getEmailAddress());
  }
  return _feedbackMessage;
}

/**
 * Returns a Map interface of configured user attributes to aid in
 * determining if a user attribute should be rendered.
 * <br/Example:

 * rendered="#{SelfCareController.hasUserAttribute['firstName']}"
 * @return the configured attribute map interface
 */
public HasAttributeMap getHasUserAttribute() {
  if (_hasAttributeMap == null) {
    _hasAttributeMap = new HasAttributeMap(getActiveUserAttributes());
  }
  return _hasAttributeMap;
}

/**
 * Gets the identity configuration associated with the application.
 * @return the identity configuration
 */
private IdentityConfiguration getIdentityConfiguration() {
  RequestContext rc = extractRequestContext();
  return rc.getApplicationConfiguration().getIdentityConfiguration();
}

/**
 * Gets the user associated with new registration requests.
 * @return the user associated with new registration requests
 */
public User getNewUser() {
  if (_newUser == null) {
    IdentityConfiguration idConfig = getIdentityConfiguration();
    _newUser = new User();
    _newUser.setCredentials(new UsernamePasswordCredentials());
    _newUser.setProfile(new UserAttributeMap(idConfig.getUserAttributeMap()));
  }
  return _newUser;
}

/**
 * Gets the credentials associated with the new registration requests.
 * @return the credentials associated with new registration requests
 */
public UsernamePasswordCredentials getNewUserCredentials() {
  return (UsernamePasswordCredentials)getNewUser().getCredentials();
}

/**
 * Encrypts a password for configuration file storage.
 * @return the enscypted password
 */
public String getEncryptedPwd() {
  String sPwd = getChangePasswordCriteria().getNewCredentials().getPassword();
  String sEncrypted = PC1_Encryptor.encrypt(sPwd);
  //String sDecrypted = PC1_Encryptor.decrypt(sEncrypted);
  //return sPwd+" "+sEncrypted+" "+sDecrypted;
  return sEncrypted;
}
/** This method does nothing, JSF chokes if it doesn't exist. */
public void setEncryptedPwd(String ignore) {}

/**
 * Gets the recover password criteria.
 * @return the recover password criteria
 */
public RecoverPasswordCriteria getRecoverPasswordCriteria() {
  if (_recoverPasswordCriteria == null) {
    _recoverPasswordCriteria = new RecoverPasswordCriteria();
  }
  return _recoverPasswordCriteria;
}

// methods =====================================================================

/**
 * Executes a change password action.
 * @param event the associated JSF action event
 * @param context the context associated with the active request
 * @throws Exception if an exception occurs
 */
private void executeChangePassword(ActionEvent event, RequestContext context)
  throws Exception {
  MessageBroker msgBroker = extractMessageBroker();
  try {

    // execute the password change,
    // set success massage and navigation outcome
    IdentityAdapter idAdapter = context.newIdentityAdapter();
    idAdapter.changePassword(context.getUser(),getChangePasswordCriteria());
    msgBroker.addSuccessMessage("identity.changePassword.success");
    setNavigationOutcome(ResourceKeys.NAVIGATIONOUTCOME_HOME_DIRECT);

  } catch (CredentialsDeniedException e) {
    msgBroker.addErrorMessage("identity.changePassword.err.old");
  } catch (PasswordPolicyException e) {
    msgBroker.addErrorMessage("identity.changePassword.err.new");
  } catch (PasswordConfirmationException e) {
    msgBroker.addErrorMessage("identity.changePassword.err.confirm");
  }
}

/**
 * Executes a recover password action.
 * @param event the associated JSF action event
 * @param context the context associated with the active request
 * @throws Exception if an exception occurs
 */
private void executeRecoverPassword(ActionEvent event, RequestContext context)
  throws Exception {
  MessageBroker msgBroker = extractMessageBroker();
  try {

    // initialize parameters, recover the password
    String sUsername = getRecoverPasswordCriteria().getUsername();
    String sEmail = getRecoverPasswordCriteria().getEmailAddress();
    IdentityAdapter idAdapter = context.newIdentityAdapter();
    User user = idAdapter.recoverPassword(getRecoverPasswordCriteria());
    if (user != null) {

      // get the new password
      UsernamePasswordCredentials upCred;
      upCred = user.getCredentials().getUsernamePasswordCredentials();
      String sPassword = upCred.getPassword();

      // send mail with the new password
      String[] args = new String[2];
      args[0] = sUsername;
      args[1] = sPassword;
      String sSubject = msgBroker.retrieveMessage("identity.forgotPassword.email.subject");
      String sBody = msgBroker.retrieveMessage("identity.forgotPassword.email.body",args);
      ApplicationConfiguration appConfig = context.getApplicationConfiguration();
      MailRequest mailReq = appConfig.getMailConfiguration().newOutboundRequest();
      mailReq.setToAddress(sEmail);
      mailReq.setSubject(sSubject);
      mailReq.setBody(sBody);
      mailReq.send();

      // add the success message, set the navigation outcome
      msgBroker.addSuccessMessage("identity.forgotPassword.success");
      setNavigationOutcome(ResourceKeys.NAVIGATIONOUTCOME_HOME_DIRECT);
    } else {

      // add the error message
      msgBroker.addErrorMessage("identity.forgotPassword.err.denied");
    }
  } finally {
  }
}

/**
 * Executes a user registration action.
 * @param event the associated JSF action event
 * @param context the context associated with the active request
 * @throws Exception if an exception occurs
 */
private void executeRegisterUser(ActionEvent event, RequestContext context)
  throws Exception {
  MessageBroker msgBroker = extractMessageBroker();
  try {

    // register the user,
    // add the success message, set navigation outcome to the home page
    IdentityAdapter idAdapter = context.newIdentityAdapter();
    idAdapter.registerUser(getNewUser());
    msgBroker.addSuccessMessage("catalog.identity.userRegistration.success");
    setNavigationOutcome(ResourceKeys.NAVIGATIONOUTCOME_HOME_DIRECT);

    // attempt to login if not single sign-on mode
    boolean bSingleSignOn = false;
    if (!bSingleSignOn) {

      // authenticate the user, add the successful login message
      User user = extractRequestContext().getUser();
      user.reset();
      user.setCredentials(getNewUser().getCredentials());
      idAdapter.authenticate(user);
      String[] args = new String[1];
      args[0] = user.getName();
      extractMessageBroker().addSuccessMessage("identity.login.success",args);
    } else {

      // navigate to login page if single sign-on mode
      setNavigationOutcome("catalog.identity.login");
    }

  } catch (UsernamePolicyException e) {
    msgBroker.addErrorMessage("identity.profile.err.username");
  } catch (PasswordPolicyException e) {
    msgBroker.addErrorMessage("identity.profile.err.password");
  } catch (PasswordConfirmationException e) {
    msgBroker.addErrorMessage("identity.profile.err.confirm");
  } catch (EmailPolicyException e) {
    msgBroker.addErrorMessage("identity.profile.err.email");
  } catch (javax.naming.NameAlreadyBoundException e) {
    msgBroker.addErrorMessage("identity.profile.err.userExists");
  }
}

/**
 * Executes the sending of a user feedback message.
 * @param event the associated JSF action event
 * @param context the context associated with the active request
 * @throws Exception if an exception occurs
 */
private void executeSendFeedback(ActionEvent event, RequestContext context)
  throws Exception {
  MessageBroker msgBroker = extractMessageBroker();
  ApplicationConfiguration appConfig = context.getApplicationConfiguration();
  FeedbackMessage msg = getFeedbackMessage();

  // validate parameters
  boolean bOk = true;
  String sName = msg.getFromName();
  String sEmail = msg.getFromAddress();
  String sBody = msg.getBody();
  String sSender = sEmail;
  if (!Val.chkEmail(sEmail)) {
    bOk = false;
    msgBroker.addErrorMessage("identity.feedback.err.email");
  } else if (sBody.length() == 0) {
    bOk = false;
    msgBroker.addErrorMessage("identity.feedback.err.body");
  } else if (sName.length() > 0) {
    sSender = sName;
  }

  // send mail if ok
  if (bOk) {

    // try to filter out mischievous content
    sSender = sSender.replaceAll("<", "<");
    sBody = sBody.replaceAll("<", "<");

    // build the message subject and body
    String[] args = new String[2];
    args[0] = sSender;
    args[1] = sBody;
    String sSubject = msgBroker.retrieveMessage("identity.feedback.email.subject");
    sBody = msgBroker.retrieveMessage("identity.feedback.email.body",args);

    // send the message to the site
    MailRequest mailReq = appConfig.getMailConfiguration().newInboundRequest();
    mailReq.setFromAddress(sEmail);
    mailReq.setSubject(sSubject);
    mailReq.setBody(sBody);
    mailReq.send();

    // send a copy of the message to the user
    MailRequest mailReqCopy = appConfig.getMailConfiguration().newOutboundRequest();
    mailReqCopy.setToAddress(sEmail);
    mailReqCopy.setSubject(sSubject);
    mailReqCopy.setBody(sBody);
    mailReqCopy.send();

    // add the success message, set the navigation outcome
    msgBroker.addSuccessMessage("identity.feedback.success");
    setNavigationOutcome(ResourceKeys.NAVIGATIONOUTCOME_HOME_DIRECT);
  }
}

/**
 * Executes a user profile update action.
 * @param event the associated JSF action event
 * @param context the context associated with the active request
 * @throws Exception if an exception occurs
 */
private void executeUpdateProfile(ActionEvent event, RequestContext context)
  throws Exception {
  MessageBroker msgBroker = extractMessageBroker();
  try {

    // make a temp user to process the update in case of failure
    User user = extractRequestContext().getUser();
    User userUpdate = new User();
    userUpdate.setKey(user.getKey());
    userUpdate.setLocalID(user.getLocalID());
    userUpdate.setDistinguishedName(user.getDistinguishedName());
    userUpdate.setProfile(getActiveUserAttributes());

    // execute the update,
    // update the in memory profile for the active user
    // set the success message and navigation outcome
    IdentityAdapter idAdapter = context.newIdentityAdapter();
    idAdapter.updateUserProfile(userUpdate);
    user.setProfile(userUpdate.getProfile());
    msgBroker.addSuccessMessage("catalog.identity.myProfile.success");
    setNavigationOutcome(ResourceKeys.NAVIGATIONOUTCOME_HOME_DIRECT);

  } catch (EmailPolicyException e) {
    msgBroker.addErrorMessage("identity.profile.err.email");
  } catch (javax.naming.NameAlreadyBoundException e) {
    msgBroker.addErrorMessage("identity.profile.err.userExists");
  }
}

/**
 * Handles a user self care action.
 *

 * The action executed is based upon a supplied "command" attribute
 * associated with the UIComponent that triggered the processAction
 * event. Command values:

 * changePassword, recoverPassword, registerUser, sendFeedback, updateProfile
 *

 *
This is the default entry point for a sub-class of BaseActionListener.
 *
This BaseActionListener handles the JSF processAction method and
 * invokes the processSubAction method of the sub-class.
 * @param event the associated JSF action event
 * @param context the context associated with the active request
 * @throws AbortProcessingException if processing should be aborted
 * @throws Exception if an exception occurs
 */
@Override
protected void processSubAction(ActionEvent event, RequestContext context)
  throws AbortProcessingException, Exception  {

  // determine the command
  IdentitySupport support = context.getIdentityConfiguration().getSupportedFunctions();
  UIComponent component = event.getComponent();
  String sCommand = Val.chkStr((String)component.getAttributes().get("command"));

  // execute the command
  if (sCommand.equals("changePassword")) {
    if (!support.getSupportsPasswordChange()) throw new NotAuthorizedException("Not authorized.");
    assertLoggedIn(context);
    executeChangePassword(event,context);
  } else if (sCommand.equals("recoverPassword")) {
    if (!support.getSupportsPasswordRecovery()) throw new NotAuthorizedException("Not authorized.");
    executeRecoverPassword(event,context);
  } else if (sCommand.equals("registerUser")) {
    if (!support.getSupportsUserRegistration()) throw new NotAuthorizedException("Not authorized.");
    executeRegisterUser(event,context);
  } else if (sCommand.equals("sendFeedback")) {
    executeSendFeedback(event,context);
  } else if (sCommand.equals("updateProfile")) {
    if (!support.getSupportsUserProfileManagement()) throw new NotAuthorizedException("Not authorized.");
    assertLoggedIn(context);
    executeUpdateProfile(event,context);
  }
}

}


text:
using System.ComponentModel.DataAnnotations;

namespace SmartHive.Web.Models.Hive
{
    public class AddHiveViewModel
    {
        public AddHiveViewModel()
        {

        }

        [Required]
        [Display(Name = "Name")]
        [StringLength(50, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 2)]
        public string Name { get; set; }

        [Required]
        [Display(Name = "DataKey")]
        public string DataKey { get; set; }

        [Required]
        [Display(Name = "Username")]
        public string Username { get; set; }
    }
}


text:
package uk.org.lidalia.sysoutslf4j.system;

import java.io.PrintStream;

import org.junit.After;
import org.junit.Before;

public abstract class SysOutOverSLF4JTestCase {

    protected ClassLoader originalContextClassLoader;
    protected PrintStream SYS_OUT;
    protected PrintStream SYS_ERR;

    @Before
    public void storeOriginalSystemOutAndErr() {
        SYS_OUT = System.out;
        SYS_ERR = System.err;
    }

    @After
    public void restoreOriginalSystemOutAndErr() {
        System.setOut(SYS_OUT);
        System.setErr(SYS_ERR);
    }

    @Before
    public void storeOriginalContextClassLoader() {
        originalContextClassLoader = Thread.currentThread().getContextClassLoader();
    }

    @After
    public void restoreOriginalContextClassLoader() {
        Thread.currentThread().setContextClassLoader(originalContextClassLoader);
    }
}


text:
package com.pholser.junit.quickcheck.internal;

import static com.pholser.junit.quickcheck.internal.Reflection.findDeclaredConstructor;
import static com.pholser.junit.quickcheck.internal.Reflection.jdk9OrBetter;

import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodHandles.Lookup;
import java.lang.invoke.MethodType;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;

public final class DefaultMethodHandleMaker {
    private static volatile Constructor<Lookup> methodLookupCtorJDK8;

    private static Constructor<Lookup> methodLookupCtorJDK8() {
        if (methodLookupCtorJDK8 == null) {
            methodLookupCtorJDK8 =
                findDeclaredConstructor(Lookup.class, Class.class, int.class);
        }

        return methodLookupCtorJDK8;
    }

    public MethodHandle handleForSpecialMethod(Method method)
        throws Exception {

        return jdk9OrBetter()
            ? jdk9OrBetterMethodHandle(method)
            : jdk8MethodHandleForDefault(method);
    }

    private MethodHandle jdk9OrBetterMethodHandle(Method method)
        throws Exception {

        return MethodHandles.lookup()
            .findSpecial(
                method.getDeclaringClass(),
                method.getName(),
                MethodType.methodType(
                    method.getReturnType(),
                    method.getParameterTypes()),
                method.getDeclaringClass());
    }

    private MethodHandle jdk8MethodHandleForDefault(Method method)
        throws Exception {

        Lookup lookup =
            methodLookupCtorJDK8().newInstance(
                method.getDeclaringClass(),
                Lookup.PRIVATE);
        return lookup.unreflectSpecial(method, method.getDeclaringClass());
    }
}


text:
package io.netty.handler.codec.http2;

import io.netty.util.internal.UnstableApi;

@UnstableApi
public final class Http2FrameStreamEvent {

    private final Http2FrameStream stream;
    private final Type type;

    enum Type {
        State,
        Writability
    }

    private Http2FrameStreamEvent(Http2FrameStream stream, Type type) {
        this.stream = stream;
        this.type = type;
    }

    public Http2FrameStream stream() {
        return stream;
    }

    public Type type() {
        return type;
    }

    static Http2FrameStreamEvent stateChanged(Http2FrameStream stream) {
        return new Http2FrameStreamEvent(stream, Type.State);
    }

    static Http2FrameStreamEvent writabilityChanged(Http2FrameStream stream) {
        return new Http2FrameStreamEvent(stream, Type.Writability);
    }
}


text:
-  [`5.11` (*5.11/Dockerfile*)](https://github.com/hinzundcode/dockerfiles/blob/master/rpi-node/5.11/Dockerfile)
-  [`6.0`, (*6.0/Dockerfile*)](https://github.com/hinzundcode/dockerfiles/blob/master/rpi-node/6.0/Dockerfile)
-  [`6.2`, `latest` (*6.2/Dockerfile*)](https://github.com/hinzundcode/dockerfiles/blob/master/rpi-node/6.2/Dockerfile)

[![](https://badge.imagelayers.io/hinzundcode/rpi-node:latest.svg)](https://imagelayers.io/?images=hinzundcode/rpi-node:5.11,hinzundcode/rpi-node:6.0,hinzundcode/rpi-node:6.2)

based on [resin/rpi-raspbian:jessie](https://hub.docker.com/r/resin/rpi-raspbian/) and [nodejs armv7l](https://nodejs.org/en/download/current/)

GitHub: [https://github.com/hinzundcode/dockerfiles/tree/master/rpi-node](https://github.com/hinzundcode/dockerfiles/tree/master/rpi-node)


text:
/**
 * Created by sergeyshapoval on 01.08.2015.
 */
$(function(){$.fn.scrollToTop=function(){$(this).hide().removeAttr("href");if($(window).scrollTop()!="0"){$(this).fadeIn("slow")}var scrollDiv=$(this);$(window).scroll(function(){if($(window).scrollTop()=="0"){$(scrollDiv).fadeOut("slow")}else{$(scrollDiv).fadeIn("slow")}});$(this).click(function(){$("html, body").animate({scrollTop:0},"slow")})}});

$(function(){$("#toTop").scrollToTop();});


text:
package choiceroulette.gui

/** Configuration keys for GUI.
  *
  * @author Alexey Kuzin <amkuzink@gmail.com>
  */
object GuiConfigs {
  lazy val configKeyPrefix: String = "gui-config"
  lazy val windowWidthConfigKey: String = configKeyPrefix + ".windowWidth"
  lazy val windowHeightConfigKey: String = configKeyPrefix + ".windowHeight"
  lazy val lastStylesheetConfigKey: String = configKeyPrefix + ".lastStylesheet"
  lazy val lastSaveResultFileConfigKey: String = configKeyPrefix + ".lastSaveResultFile"
  lazy val viewTypeConfigKey: String = configKeyPrefix + ".viewType"
  lazy val lastGrabFileConfigKey: String = configKeyPrefix + ".lastGrabFile"
}


text:
$(document).ready(function()
{
	$("#commentForm").compile(function(data)
	{
		var result = $.api.comment.insertComment(data);
		if(result.code == 1000)
		{
			refresh();
		}
		else
		{
			console.error(result);
		}
	});

	$("#deleteArticle").on("click", function()
	{
		var result = $.api.article.deleteArticle({boardId : $.query.boardId, seq : $.query.seq, isRemove : "Y"});
		if(result.code == 1000)
		{
			location.href = "?fragment=qna&boardId=" + $.query.boardId;
		}
	});

	bindReplyComment();
});

function refresh()
{
	var result = $.api.comment.getCommentList({boardId : $.query.boardId, articleSeq : $.query.seq});
	if(result.code == 1000)
	{
		var html = $("#communityCommentTemplate").html();
		var template = Handlebars.compile(html);

		$("#commentList").html(template({commentList : result.data}));
		bindReplyComment();
	}
	else
	{
		console.error(result);
	}
}

function bindReplyComment()
{
	$("*[data-id='replyComment']").on("click", function()
	{
		var parent = $(this).parent().parent();
		if(parent.children("form").length > 0)
			return;

		var groupId = $(this).attr("data-groupid");
		var seq = $(this).attr("data-seq");

		var form = document.createElement("form");
		form.setAttribute("data-component", "form");
		$(form).html($("#commentWriteTemplate").html());

		parent.append(form);

		$(form).compile(function(data)
		{
			data.groupId = groupId;
			data.parentSeq = seq;

			var result = $.api.comment.insertComment(data);
			if(result.code == 1000)
			{
				refresh();
			}
			else
			{
				console.error(result);
			}
		});

		$(form).find("textarea").focus();
	});
}


text:
var searchData=
[
  ['unit',['Unit',['../struct_tempo_1_1_unit.html',1,'Tempo']]],
  ['updateable',['Updateable',['../class_tempo_1_1_scheduling_1_1_updateable.html',1,'Tempo::Scheduling']]],
  ['updatescheduler',['UpdateScheduler',['../class_tempo_1_1_scheduling_1_1_update_scheduler.html',1,'Tempo::Scheduling']]]
];