text:
title:  Un gând de încheiere
date:  08/03/2019
---

"Marea lucrare a Evangheliei nu se va încheia cu o manifestare mai mică a puterii lui Dumnezeu decât cea care i-a marcat începutul. (…)

Mesajul va fi transmis nu atât de mult prin argumente, cât prin convingerea profundă produsă de Duhul lui Dumnezeu. Argumentele au fost prezentate. Sămânţa a fost semănată, iar acum va răsări şi va aduce rod" (Ellen G. White, Tragedia veacurilor, ed. 2011, p. 503).

Vestirea mesajului final al lui Dumnezeu va împărţi oamenii în două mari tabere: cei care au o relaţie cu Dumnezeu şi cei care aleg să meargă după fiară. Împărţirea aceasta este reprezentată prin două simboluri: strângerea grâului (Apocalipsa 14:14-16) şi culegerea strugurilor ca să fie călcaţi în teasc (Apocalipsa 14:17-20). Acesta este subiectul capitolelor 17 şi 18 din Apocalipsa.

Studiu suplimentar: Tragedia veacurilor, cap. 38, "Ultima avertizare".

**Biblia şi cartea istoria mântuirii – studiu la rând**:

**Biblia: Numeri 16-22**

`1. Cine i-a(u) reproşat lui Moise că nu ţara promisă, ci Egiptul era "o ţară, unde curge lapte şi miere"?`

`2. Ce i-au zis copii lui Israel lui Moise după testul toiegelor?`

`3. Ce lucru destinat curăţirii îl făcea necurat pe cel ce-l folosea sau care se atingea de el?`

`4. Cui i s-a spus că drumul pe care mergea ducea la pierzare?`

**Istoria mântuirii, capitolul 54**

`5. Când va forma America protestantă un chip al ierarhiei romane?`


text:
function getcost(stat){};
function getrate(stat){
  if (stat.currentammount>=stat.maxammount && ratevalue>=0) {
    return 0;
  }
  if (stat.currentammount<=stat.maxammount && ratevalue<0) {
    return 0;
  }
  return -1;  //PLACEHOLDER
};
///////////////////////////////////////
var Objects=
{
   reactorbutton : {
      type: "button",
      header:"John",
      text:"Doe",
      cost: getcost("reactor"),
  },

   quartersbutton : {
      type: "button",
      header:"Quarters",
      text:"This is a rather long text describing the quarters. The quarters can be described in much less words, but we like to be thorough and hit all the incremental cliches like stupid jokes on every description and not having a sense of humour and not being funny. People live in here! Peace.",
  },

  foodstat : {
    selector: "foodcurrent",
    type: "stat",
    header:"John",
    text:"Doe",
    maxammount: 50,
    currentammount: 0,
    updaterate: getrate("food"),
  },
 waterstat : {
    selector: "watercurrent",
    type: "stat",
    header:"John",
    text:"Doe",
    maxammount: 50,
    currentammount: 0,
    updaterate: getrate("water"),
  },
 oxygenstat : {
    selector: "oxygencurrent",
    type: "stat",
    header:"John",
    text:"Doe",
    maxammount: 50,
    currentammount: 0,
    updaterate: getrate("oxygen"),
  },
metalsstat : {
    selector: "metalscurrent",
    type: "stat",
    header:"John",
    text:"Doe",
    maxammount: 50,
    currentammount: 0,
    updaterate: getrate("metals"),
  },

};

///////////////////////////////////////

redpajama_set_name: RedPajamaGithub


text:
/* Compile:
cl /nologo /LDd /W3 /GF /MTd /Zi /O2 /Ob2 /Ferlm_sql_sybase /I../proj /I../site/sybase/include sql_sybase.c ../proj/lib/radutil.a ws2_32.lib ../site/sybase/lib/libct.lib ../site/sybase/lib/libcs.lib /DRAD_DLL
 */

#include <radutil/radutil.h>
#include <radsql/radsql.h>

#include <ctpublic.h>

typedef struct rlm_sql_sybase_sock {
	CS_CONTEXT	*context;
	CS_CONNECTION	*connection;
	CS_COMMAND	*command;
	char		**results;
	int		id;
	int		in_use;
	struct timeval	tv;
    int     num_fields_cache;
    CS_INT *field_size_cache;
    int     affected_rows_cache;
} rlm_sql_sybase_sock;

#define	MAX_DATASTR_LEN	64

/************************************************************************
* Handler for server messages. Client-Library will call this
* routine when it receives a message from the server.
************************************************************************/

static CS_RETCODE CS_PUBLIC
servermsg_callback(cp, chp, msgp)
CS_CONTEXT         *cp;
CS_CONNECTION      *chp;
CS_SERVERMSG       *msgp;
{
    char mod[1024];

    /*
    ** Print the server and procedure names if supplied.
    */
    if (msgp->svrnlen > 0 && msgp->proclen > 0)
        sNprintf(mod, sizeof(mod), "Server(%s) Notice of Procedure(%s)",
                 msgp->svrname, msgp->proc);
    else if (msgp->svrnlen > 0)
        sNprintf(mod, sizeof(mod), "Server(%s) Notice",
                 msgp->svrname);
    else if (msgp->proclen > 0)
        sNprintf(mod, sizeof(mod), "Server Notice of Procedure(%s)",
                 msgp->proc);
    else
        sNprintf(mod, sizeof(mod), "Server Notice");

    /*
    ** Print the message info.
    */
    radlog(L_ERROR+1, "[rlm_sql_sybase] [%s] "
           "number(%ld) severity(%ld) state(%ld) line(%ld) %s",
           mod,
           (long)msgp->msgnumber, (long)msgp->severity,
           (long)msgp->state, (long)msgp->line,
           msgp->text);

    /*
    ** Server message callbacks must return CS_SUCCEED.
    */
    return (CS_SUCCEED);
}

/************************************************************************
*  Client-Library error handler.
************************************************************************/

static CS_RETCODE CS_PUBLIC
clientmsg_callback(context, conn, emsgp)
CS_CONTEXT         *context;
CS_CONNECTION      *conn;
CS_CLIENTMSG       *emsgp;
{
    /*
    ** Error number: Print the error's severity, number, origin, and
    ** layer. These four numbers uniquely identify the error.
    */
    radlog(L_ERROR+1, "[rlm_sql_sybase] [Client Library] "
           "layer(%ld) origin(%ld) severity(%ld) number(%ld) %s",
           (long)CS_LAYER(emsgp->msgnumber),
           (long)CS_ORIGIN(emsgp->msgnumber),
           (long)CS_SEVERITY(emsgp->msgnumber),
           (long)CS_NUMBER(emsgp->msgnumber),
           emsgp->msgstring);

    if (emsgp->osstringlen > 0)
        radlog(L_ERROR+1, "[rlm_sql_sybase] [Operating System] number(%ld) %s",
               (long)emsgp->osnumber, emsgp->osstring);

    return (CS_SUCCEED);
}

/************************************************************************
*  CS-Library error handler. This function will be invoked
*  when CS-Library has detected an error.
************************************************************************/

static CS_RETCODE CS_PUBLIC
csmsg_callback(context, emsgp)
CS_CONTEXT         *context;
CS_CLIENTMSG       *emsgp;
{
    /*
    ** Print the error number and message.
    */
    radlog(L_ERROR+1, "[rlm_sql_sybase] [CS-Library] "
           "layer(%ld) origin(%ld) severity(%ld) number(%ld) %s",
           (long)CS_LAYER(emsgp->msgnumber),
           (long)CS_ORIGIN(emsgp->msgnumber),
           (long)CS_SEVERITY(emsgp->msgnumber),
           (long)CS_NUMBER(emsgp->msgnumber),
           emsgp->msgstring);

    /*
    ** Print any operating system error information.
    */
    if (emsgp->osstringlen > 0)
        radlog(L_ERROR+1, "[rlm_sql_sybase] [Operating System] number(%ld) %s",
               (long)emsgp->osnumber, emsgp->osstring);

    return (CS_SUCCEED);
}

/*************************************************************************
 *
 *	Function: sql_error
 *
 *	Purpose: database specific error. Returns error associated with
 *               connection
 *
 *************************************************************************/
static char *sql_error(SQLSOCK *sqlsocket, SQL_CONFIG *config) {
	static char	msg = '\0';
	return &msg;
}

/*************************************************************************
 *
 *	Function: sql_close
 *
 *	Purpose: database specific close. Closes an open database
 *               connection and cleans up any open handles.
 *
 *************************************************************************/
static int sql_close(SQLSOCK *sqlsocket, SQL_CONFIG *config) {

	rlm_sql_sybase_sock *sybase_sock = sqlsocket->conn;
    rad_assert(sybase_sock != NULL);

    if(sybase_sock->connection != (CS_CONNECTION *)NULL) {
        ct_close(sybase_sock->connection, CS_FORCE_CLOSE);
        ct_con_drop(sybase_sock->connection);
    }

    if (sybase_sock->context != (CS_CONTEXT *)NULL) {
        ct_exit(sybase_sock->context, CS_FORCE_EXIT);
        cs_ctx_drop(sybase_sock->context);
    }

	sybase_sock->connection = NULL;

	return 0;
}

/*************************************************************************
 *
 *	Function: sql_destroy_socket
 *
 *	Purpose: Free socket and private connection data
 *
 *************************************************************************/
static int sql_destroy_socket(SQLSOCK *sqlsocket, SQL_CONFIG *config)
{
	rad_free(sqlsocket->conn);
	sqlsocket->conn = NULL;
	return 0;
}

/*************************************************************************
 *
 *	Function: sql_finish_query
 *
 *	Purpose: End the query, such as freeing memory
 *
 *************************************************************************/
static int sql_finish_query(SQLSOCK *sqlsocket, SQL_CONFIG *config)
{
	rlm_sql_sybase_sock *sybase_sock = sqlsocket->conn;
    rad_assert(sybase_sock != NULL);

	ct_cancel(NULL, sybase_sock->command, CS_CANCEL_ALL);

	if (ct_cmd_drop(sybase_sock->command) != CS_SUCCEED) {
		radlog(L_ERROR|L_CONS, "[rlm_sql_sybase] finish_query: "
               "Freeing command structure failed.");
		return -1;
	}

	return 0;
}

/*************************************************************************
 *
 *	Function: sql_num_rows
 *
 *	Purpose: database specific num_rows. Returns number of rows in
 *               query
 *
 *************************************************************************/
static int sql_num_rows(SQLSOCK *sqlsocket, SQL_CONFIG *config) {

	rlm_sql_sybase_sock *sybase_sock = sqlsocket->conn;
	int	num;
    rad_assert(sybase_sock != NULL);

	if (ct_res_info(sybase_sock->command, CS_ROW_COUNT,
                    (CS_INT *)&num, CS_UNUSED, NULL) != CS_SUCCEED) {
		radlog(L_ERROR|L_CONS, "[rlm_sql_sybase] num_rows: "
               "Error retrieving row count %s",
               sql_error(sqlsocket, config));
		return -1;
	}
	return num;
}

/*************************************************************************
 *
 *	Function: sql_query
 *
 *	Purpose: Issue a non-SELECT query (ie: update/delete/insert) to
 *               the database.
 *
 *************************************************************************/
static int sql_query(SQLSOCK *sqlsocket, SQL_CONFIG *config, const char *querystr) {

	rlm_sql_sybase_sock *sybase_sock = sqlsocket->conn;

	CS_RETCODE	ret, results_ret;
	CS_INT		result_type;
    CS_INT		count;

    rad_assert(sybase_sock != NULL);

	if (config->sqltrace)
		radlog(config->sqltracelevel, "[rlm_sql_sybase] [SQL] %s", querystr);
    if (sybase_sock->connection == NULL) {
		radlog(L_ERROR|L_CONS, "[rlm_sql_sybase] query: Socket not connected");
		return SQL_DOWN;
	}

	if (ct_cmd_alloc(sybase_sock->connection, &sybase_sock->command) != CS_SUCCEED) {
		radlog(L_ERROR|L_CONS, "[rlm_sql_sybase] query: "
               "Unable to allocate command structure (ct_cmd_alloc()) %s",
				sql_error(sqlsocket, config));
		return -1;
	}

	if (ct_command(sybase_sock->command, CS_LANG_CMD, (char*)querystr,
                   CS_NULLTERM, CS_UNUSED) != CS_SUCCEED) {
		radlog(L_ERROR|L_CONS, "[rlm_sql_sybase] query: "
               "Unable to initiate command structure (ct_command()) %s",
				sql_error(sqlsocket, config));
        sql_finish_query(sqlsocket, config);
		return -1;
	}

	if (ct_send(sybase_sock->command) != CS_SUCCEED) {
		radlog(L_ERROR|L_CONS, "[rlm_sql_sybase] query: "
               "Unable to send command (ct_send()) %s",
				sql_error(sqlsocket, config));
        sql_finish_query(sqlsocket, config);
		return SQL_DOWN;
	}

	/*
	** We'll make three calls to ct_results,
    ** first to get a success indicator, secondly to get a done indicator,
    ** and thirdly to get a "nothing left to handle" status.
	*/
results:
	/*
	** First call to ct_results,
	** we need returncode CS_SUCCEED
	** and result_type CS_CMD_SUCCEED or CS_STATUS_RESULT.
    **
    ** Note: CS_STATUS_RESULT is got when a store procedure without
    ** row result is executed.
	*/

	if ((results_ret = ct_results(sybase_sock->command, &result_type)) == CS_SUCCEED) {
        TRACE("[rlm_sql_sybase] query (step 1): result_type is %d", result_type);
		if (result_type != CS_CMD_SUCCEED && result_type != CS_STATUS_RESULT) {
			if  (result_type == CS_ROW_RESULT) {
				radlog(L_ERROR|L_CONS, "[rlm_sql_sybase] query (step 1): "
                       "sql_query processed a query returning rows. "
                       "Use sql_select_query instead!");
			}
			radlog(L_ERROR|L_CONS, "[rlm_sql_sybase] query (step 1): "
                   "Result failure or unexpected result type from query %s",
                   sql_error(sqlsocket, config));
            sql_finish_query(sqlsocket, config);
			return -1;
		}

        if(result_type == CS_STATUS_RESULT) { /* fetch the status  */
            while ((ret = ct_fetch(sybase_sock->command, CS_UNUSED,
                                   CS_UNUSED, CS_UNUSED, &count)) != CS_END_DATA) {
                if (ret != CS_SUCCEED) {
                    radlog(L_ERROR|L_CONS, "[rlm_sql_sybase] query (step 1): "
                           "Failure retrieving query status %s",
                           sql_error(sqlsocket, config));
                    sql_finish_query(sqlsocket, config);
                    return -1;
                }
            }

            goto results;
        }
	}
	else {
		switch ((int) results_ret)
		{

		case CS_FAIL: /* Serious failure, sybase requires us to
                         cancel and maybe even close connection */
			radlog(L_ERROR|L_CONS, "[rlm_sql_sybase] query (step 1): "
                   "Failure retrieving query results %s",
                   sql_error(sqlsocket, config));
            sql_finish_query(sqlsocket, config);
			if ((ret = ct_cancel(NULL, sybase_sock->command, CS_CANCEL_ALL)) == CS_FAIL) {
				radlog(L_ERROR|L_CONS, "[rlm_sql_sybase] query (step 1): "
                       "Fail to do ct_cancel(), close connection");
				sql_close(sqlsocket, config);
			}
			return -1;
			break;

		default:
			radlog(L_ERROR|L_CONS, "[rlm_sql_sybase] query (step 1): "
                   "Unexpected return value from ct_results() %s",
                   sql_error(sqlsocket, config));
            sql_finish_query(sqlsocket, config);
			return -1;
		}
	}

	/*
	** Second call to ct_results,
	** we need returncode CS_SUCCEED
	** and result_type CS_CMD_DONE.
	*/

	if ((results_ret = ct_results(sybase_sock->command, &result_type)) == CS_SUCCEED) {
        TRACE("[rlm_sql_sybase] query (step 2): result_type is %d", result_type);
		if (result_type != CS_CMD_DONE) {
			radlog(L_ERROR|L_CONS, "[rlm_sql_sybase] query (step 2): "
                   "Result failure or unexpected result type from query %s",
                   sql_error(sqlsocket, config));
            sql_finish_query(sqlsocket, config);
			return -1;
		}

        /*
        ** See the Sybase manual for ct_res_info():
        **
        ** CS_ROW_COUNT: The number of rows affected by the current command.
        ** Can be called only after a ct_results() of type CS_CMD_DONE,
        ** CS_CMD_FAIL or CS_CMD_SUCCEED.
        */

        sybase_sock->affected_rows_cache = sql_num_rows(sqlsocket, config);
	}
	else {
		switch ((int) results_ret)
		{

		case CS_FAIL: /* Serious failure, sybase requires us to
                         cancel and maybe even close connection */
			radlog(L_ERROR|L_CONS, "[rlm_sql_sybase] query (step 2): "
                   "Failure retrieving query results %s",
                   sql_error(sqlsocket, config));
            sql_finish_query(sqlsocket, config);
			if ((ret = ct_cancel(NULL, sybase_sock->command, CS_CANCEL_ALL)) == CS_FAIL) {
                radlog(L_ERROR|L_CONS, "[rlm_sql_sybase] query (step 2): "
                       "Fail to do ct_cancel(), close connection");
				sql_close(sqlsocket, config);
            }
			return -1;
			break;

		default:
			radlog(L_ERROR|L_CONS, "[rlm_sql_sybase] query (step 2): "
                   "Unexpected return value from ct_results() %s",
                   sql_error(sqlsocket, config));
            sql_finish_query(sqlsocket, config);
			return -1;
		}
	}

	/*
	** Third call to ct_results,
	** we need returncode CS_END_RESULTS
	** result_type will be ignored.
	*/

	results_ret = ct_results(sybase_sock->command, &result_type);

	switch ((int) results_ret)
	{

	case CS_FAIL: /* Serious failure, sybase requires us to
                     cancel and maybe even close connection */
		radlog(L_ERROR|L_CONS, "[rlm_sql_sybase] query (step 3): "
               "Failure retrieving query results %s",
               sql_error(sqlsocket, config));
        sql_finish_query(sqlsocket, config);
		if ((ret = ct_cancel(NULL, sybase_sock->command, CS_CANCEL_ALL)) == CS_FAIL) {
            radlog(L_ERROR|L_CONS, "[rlm_sql_sybase] query (step 3): "
                   "Fail to do ct_cancel(), close connection");
            sql_close(sqlsocket, config);
		}
		return -1;
		break;

	case CS_END_RESULTS:  /* This is where we want to end up */
		break;

	default:
		radlog(L_ERROR|L_CONS, "[rlm_sql_sybase] query (step 3): "
               "Unexpected return value from ct_results() %s",
               sql_error(sqlsocket, config));
        sql_finish_query(sqlsocket, config);
		return -1;
		break;
	}

	return 0;
}

/*************************************************************************
 *
 *	Function: sql_init_socket
 *
 *	Purpose: Establish connection to the db
 *
 *************************************************************************/
static int sql_init_socket(SQLSOCK *sqlsocket, SQL_CONFIG *config) {

    char cmdbuf[256];
	rlm_sql_sybase_sock *sybase_sock;

    rad_assert(sqlsocket != NULL);
	if (!sqlsocket->conn) {
		sqlsocket->conn = (rlm_sql_sybase_sock *)rad_malloc(sizeof(rlm_sql_sybase_sock));
		if (!sqlsocket->conn) {
			return -1;
		}
	}
    memset(sqlsocket->conn, 0, sizeof(rlm_sql_sybase_sock));

	sybase_sock = sqlsocket->conn;

	/* Allocate a CS context structure. This should really only be
       done once, but because of the connection pooling design of
       rlm_sql, we'll have to go with one context per connection */

	if (cs_ctx_alloc(CS_VERSION_100, &sybase_sock->context) != CS_SUCCEED) {
		radlog(L_ERROR|L_CONS, "[rlm_sql_sybase] init_socket: "
               "Unable to allocate CS context structure (cs_ctx_alloc())");
        sql_close(sqlsocket, config);
		return -1;
	}

	/* Initialize ctlib */

	if (ct_init(sybase_sock->context, CS_VERSION_100) != CS_SUCCEED) {
		radlog(L_ERROR|L_CONS, "[rlm_sql_sybase] init_socket: "
               "Unable to initialize Client-Library (ct_init())");
        sql_close(sqlsocket, config);
		return -1;
	}

	/* Install callback functions for error-handling */

    if (cs_config(sybase_sock->context, CS_SET, CS_MESSAGE_CB,
                  (CS_VOID *)csmsg_callback, CS_UNUSED, NULL) != CS_SUCCEED) {
		radlog(L_ERROR|L_CONS, "[rlm_sql_sybase] init_socket: "
               "Unable to install CS Library error callback");
        sql_close(sqlsocket, config);
		return -1;
	}

	if (ct_callback(sybase_sock->context, NULL, CS_SET, CS_CLIENTMSG_CB,
                    (CS_VOID *)clientmsg_callback) != CS_SUCCEED) {
		radlog(L_ERROR|L_CONS, "[rlm_sql_sybase] init_socket: "
               "Unable to install client message callback");
        sql_close(sqlsocket, config);
		return -1;
	}

	if (ct_callback(sybase_sock->context, NULL, CS_SET, CS_SERVERMSG_CB,
                    (CS_VOID *)servermsg_callback) != CS_SUCCEED) {
		radlog(L_ERROR|L_CONS, "[rlm_sql_sybase] init_socket: "
               "Unable to install server message callback");
        sql_close(sqlsocket, config);
		return -1;
	}

	/* Allocate a ctlib connection structure */

	if (ct_con_alloc(sybase_sock->context, &sybase_sock->connection) != CS_SUCCEED) {
		radlog(L_ERROR|L_CONS, "[rlm_sql_sybase] init_socket: "
               "Unable to allocate connection structure (ct_con_alloc())");
        sql_close(sqlsocket, config);
		return -1;
	}

	/* Initialize inline error handling for the connection */

/*	if (ct_diag(sybase_sock->connection, CS_INIT, CS_UNUSED, CS_UNUSED, NULL) != CS_SUCCEED) {
		radlog(L_ERROR|L_CONS, "[rlm_sql_sybase] init_socket: "
               "Unable to initialize error handling (ct_diag())");
        sql_close(sqlsocket, config);
		return -1;
	} */

	/* Set User and Password properties for the connection */

	if (ct_con_props(sybase_sock->connection, CS_SET, CS_USERNAME, config->sql_login,
					 strlen(config->sql_login), NULL) != CS_SUCCEED) {
		radlog(L_ERROR|L_CONS, "[rlm_sql_sybase] init_socket: "
               "Unable to set username for connection (ct_con_props()) %s",
               sql_error(sqlsocket, config));
        sql_close(sqlsocket, config);
		return -1;
	}

	if (ct_con_props(sybase_sock->connection, CS_SET, CS_PASSWORD, config->sql_password,
					strlen(config->sql_password), NULL) != CS_SUCCEED) {
		radlog(L_ERROR|L_CONS, "[rlm_sql_sybase] init_socket: "
               "Unable to set password for connection (ct_con_props()) %s",
               sql_error(sqlsocket, config));
        sql_close(sqlsocket, config);
		return -1;
	}

	/* Establish the connection */

	if (ct_connect(sybase_sock->connection, config->sql_server,
                   strlen(config->sql_server)) != CS_SUCCEED) {
		radlog(L_ERROR|L_CONS, "[rlm_sql_sybase] init_socket: "
               "Unable to establish connection to symbolic servername %s %s",
				config->sql_server, sql_error(sqlsocket, config));
        sql_close(sqlsocket, config);
		return -1;
	}

    /* Use the database if specified */
    if (config->sql_db[0]) {
        sNprintf(cmdbuf, sizeof(cmdbuf), "use %s", config->sql_db);
        if(sql_query(sqlsocket, config, cmdbuf) == 0)
            sql_finish_query(sqlsocket, config);
    }

	return 0;
}

/*************************************************************************
 *
 *	Function: sql_finish_select_query
 *
 *	Purpose: End the select query, such as freeing memory or result
 *
 *************************************************************************/
static int sql_finish_select_query(SQLSOCK *sqlsocket, SQL_CONFIG *config) {

	rlm_sql_sybase_sock *sybase_sock = sqlsocket->conn;
	int	i=0;
    rad_assert(sybase_sock != NULL);

    if (sybase_sock->results) {
        while(sybase_sock->results[i]) rad_free(sybase_sock->results[i++]);
        rad_free(sybase_sock->results);
        sybase_sock->results=NULL;
    }

    if(sybase_sock->num_fields_cache != 0) {
        rad_free(sybase_sock->field_size_cache);
        sybase_sock->field_size_cache = NULL;
        sybase_sock->num_fields_cache = 0;
    }

	ct_cancel(NULL, sybase_sock->command, CS_CANCEL_ALL);

	if (ct_cmd_drop(sybase_sock->command) != CS_SUCCEED) {
		radlog(L_ERROR|L_CONS, "[rlm_sql_sybase] finish_select_query: "
               "Freeing command structure failed.");
		return -1;
	}

	return 0;
}

/*************************************************************************
 *
 *	Function: sql_num_fields
 *
 *	Purpose: database specific num_fields function. Returns number
 *               of columns from query
 *
 *************************************************************************/
static int sql_num_fields(SQLSOCK *sqlsocket, SQL_CONFIG *config) {

	rlm_sql_sybase_sock *sybase_sock = sqlsocket->conn;
	int	num;
    rad_assert(sybase_sock != NULL);

	if (ct_res_info(sybase_sock->command, CS_NUMDATA,
                    (CS_INT *)&num, CS_UNUSED, NULL) != CS_SUCCEED) {
		radlog(L_ERROR|L_CONS, "[rlm_sql_sybase] num_fields: "
               "Error retrieving column count %s",
               sql_error(sqlsocket, config));
		return -1;
	}
	return num;
}

/*************************************************************************
 *
 *	Function: sql_select_query
 *
 *	Purpose: Issue a select query to the database
 *
 *	Note: Only the first row from queries returning several rows
 *	      will be returned by this function, consequitive rows will
 *	      be discarded.
 *
 *************************************************************************/
static int sql_select_query(SQLSOCK *sqlsocket, SQL_CONFIG *config, const char *querystr) {

	rlm_sql_sybase_sock *sybase_sock = sqlsocket->conn;

	CS_RETCODE	ret, results_ret;
	CS_INT		result_type;
	CS_DATAFMT	descriptor;
    CS_INT      dtype;
    CS_INT      dsize;

	int		colcount,i;
	char    **rowdata = NULL;
    CS_INT  *colsize;

    rad_assert(sybase_sock != NULL);

	if (config->sqltrace)
		radlog(config->sqltracelevel, "[rlm_sql_sybase] [SQL] %s", querystr);
    if (sybase_sock->connection == NULL) {
		radlog(L_ERROR|L_CONS, "[rlm_sql_sybase] select_query: Socket not connected");
		return SQL_DOWN;
	}

	if (ct_cmd_alloc(sybase_sock->connection, &sybase_sock->command) != CS_SUCCEED) {
		radlog(L_ERROR|L_CONS, "[rlm_sql_sybase] select_query: "
               "Unable to allocate command structure (ct_cmd_alloc()) %s",
               sql_error(sqlsocket, config));
		return -1;
	}

	if (ct_command(sybase_sock->command, CS_LANG_CMD, (char*)querystr,
                   CS_NULLTERM, CS_UNUSED) != CS_SUCCEED) {
		radlog(L_ERROR|L_CONS, "[rlm_sql_sybase] select_query: "
               "Unable to initiate command structure (ct_command()) %s",
               sql_error(sqlsocket, config));
        sql_finish_select_query(sqlsocket, config);
		return -1;
	}

	if (ct_send(sybase_sock->command) != CS_SUCCEED) {
		radlog(L_ERROR|L_CONS, "[rlm_sql_sybase] select_query: "
               "Unable to send command (ct_send()) %s",
               sql_error(sqlsocket, config));
        sql_finish_select_query(sqlsocket, config);
		return SQL_DOWN;
	}

	results_ret = ct_results(sybase_sock->command, &result_type);

	switch (results_ret) {

	case CS_SUCCEED:

		switch (result_type) {

		case CS_ROW_RESULT:

		/*
		** Houston, we have a row.
		**
		** We set up a target buffer for the results data, and
		** associate the buffer with the results, but the actual
		** fetching takes place in sql_fetch_row. The layer above
		** MUST call sql_fetch_row and/or sql_finish_select_query
		** or this socket will be unusable and may cause segfaults
		** if reused later on.
		*/

			colcount = sql_num_fields(sqlsocket, config);
            TRACE("[rlm_sql_sybase] select_query: colcount %d", colcount);
            colsize = (CS_INT *)rad_malloc(sizeof(CS_INT) * colcount);
            /* Get number of elements in row result */

			rowdata=(char **)rad_malloc(sizeof(char *) * (colcount+1));	/* Space for pointers */
			memset(rowdata, 0, sizeof(char *) * (colcount+1));       /* NULL-pad the pointers */

			for (i=0; i < colcount; i++) {

                ret = ct_describe(sybase_sock->command, i+1, &descriptor);
                if(ret != CS_SUCCEED) {
                    radlog(L_ERROR|L_CONS, "[rlm_sql_sybase] select_query: "
                           "ct_describe failed %s",
                           sql_error(sqlsocket, config));
                    goto fail;
                }

                dtype = descriptor.datatype;
                dsize = MAX_DATASTR_LEN;

           		/*
        		 * Use the retrieved length of dname to allocate an output
		         * buffer, and then define the output variable (but only
		         * for char/string type columns).
		         */
                switch(dtype) {
		        case CS_CHAR_TYPE:
		        case CS_VARCHAR_TYPE:
		        case CS_TEXT_TYPE:
                    dsize = descriptor.maxlength;
                    TRACE("[rlm_sql_syabse] select_query: column %d, chars type %d, size %d",
                          i+1, dtype, dsize);
                    if(dsize > 1024) {
                        radlog(L_WARN, "[rlm_sql_sybase] select_query: "
                               "column %d, chars type %d, size %d too long! truncate to 1024",
                               i+1, dtype, dsize);
                        dsize = 1024;
                    }
                    rowdata[i] = rad_malloc(dsize+1);
                    colsize[i] = dsize+1;
                    break;
		        case CS_IMAGE_TYPE:
                case CS_BINARY_TYPE:
		        case CS_VARBINARY_TYPE:
		        case CS_BIT_TYPE:
		        case CS_TINYINT_TYPE:
		        case CS_SMALLINT_TYPE:
		        case CS_INT_TYPE:
		        case CS_REAL_TYPE:
		        case CS_FLOAT_TYPE:
		        case CS_MONEY_TYPE:
		        case CS_MONEY4_TYPE:
		        case CS_DATETIME_TYPE:
		        case CS_DATETIME4_TYPE:
		        case CS_NUMERIC_TYPE:
		        case CS_DECIMAL_TYPE:
                    TRACE("[rlm_sql_syabse] select_query: column %d, other type %d, size %d",
                          i+1, dtype, dsize);
                    rowdata[i] = rad_malloc(dsize+1);
                    colsize[i] = dsize+1;
                    break;
                default:
                    radlog(L_WARN, "[rlm_sql_sybase] select_query: "
                           "Unsupported date type (%d) at column %d",
                           dtype, i+1);
			        rowdata[i]=rad_malloc(dsize+1);
                    colsize[i]=dsize+1;
			        break;
                }

			    /*
			    ** Set up the DATAFMT structure that describes our target array
			    ** and tells sybase what we want future ct_fetch calls to do.
			    */
			    descriptor.datatype = CS_CHAR_TYPE;     /* The target buffer is a string */
			    descriptor.format = CS_FMT_NULLTERM;    /* Null termination please */
			    descriptor.maxlength = dsize+1;       	/* The string arrays are this large */
			    descriptor.count = 1;			        /* Fetch one row of data */
			    descriptor.locale = NULL;		        /* Don't do NLS stuff */

				/* Associate the target buffer with the data */
				if (ct_bind(sybase_sock->command, i+1, &descriptor,
                            rowdata[i], NULL, NULL) != CS_SUCCEED) {
					radlog(L_ERROR|L_CONS, "[rlm_sql_sybase] select_query: "
                           "ct_bind() failed %s",
                           sql_error(sqlsocket, config));
					goto fail;
				}

			}
			break;

		case CS_CMD_SUCCEED:
		case CS_CMD_DONE:

			radlog(L_ERROR|L_CONS, "[rlm_sql_sybase] select_query: Query returned no data");
			break;

        case CS_STATUS_RESULT:

            /* Haaa..., Execute store procedure with select_query. */
            radlog(L_DEBUG+1, "[rlm_sql_sybase] select_query: Query returned status");
            colcount = 0;
            colsize = NULL;
            rowdata = NULL;
            break;

		default:

			radlog(L_ERROR|L_CONS, "[rlm_sql_sybase] select_query: "
                   "Unexpected result type from query %s",
                   sql_error(sqlsocket, config));
			sql_finish_select_query(sqlsocket, config);
            return -1;
			break;
		}
		break;

	case CS_FAIL:

		/*
		** Serious failure, sybase requires us to cancel
		** the results and maybe even close the connection.
		*/

		radlog(L_ERROR|L_CONS, "[rlm_sql_sybase] select_query: "
               "Failure retrieving query results %s",
               sql_error(sqlsocket, config));
        sql_finish_select_query(sqlsocket, config);
		if ((ret = ct_cancel(NULL, sybase_sock->command, CS_CANCEL_ALL)) == CS_FAIL) {
			radlog(L_ERROR|L_CONS, "[rlm_sql_sybase] select_query: "
                   "Fail to do ct_cancel(), close connection");
			sql_close(sqlsocket, config);
		}
		return -1;
		break;

	default:

		radlog(L_ERROR|L_CONS, "[rlm_sql_sybase] select_query: "
               "Unexpected return value from ct_results() %s",
               sql_error(sqlsocket, config));
        sql_finish_select_query(sqlsocket, config);
		return -1;
		break;
	}

    rad_assert(sybase_sock->num_fields_cache == 0);
    sybase_sock->num_fields_cache = colcount;
    rad_assert(sybase_sock->field_size_cache == NULL);
    sybase_sock->field_size_cache = colsize;
    rad_assert(sybase_sock->results == NULL);
    sybase_sock->results = rowdata;

	return 0;

fail:

    rad_free(colsize);
    for(i=0; i<colcount+1; i++) rad_free(rowdata[i]);
    rad_free(rowdata);

    sql_finish_select_query(sqlsocket, config);

    return -1;
}

/*************************************************************************
 *
 *	Function: sql_store_result
 *
 *	Purpose: database specific store_result function. Returns a result
 *               set for the query.
 *
 *************************************************************************/
static int sql_store_result(SQLSOCK *sqlsocket, SQL_CONFIG *config) {
	/*
	** Not needed for Sybase, code that may have gone here is
	** in sql_select_query and sql_fetch_row
	*/
	return 0;
}

/*************************************************************************
 *
 *	Function: sql_fetch_row
 *
 *	Purpose: database specific fetch_row. Returns a SQL_ROW struct
 *               with all the data for the query in 'sqlsocket->row'. Returns
 *		 0 on success, -1 on failure, SQL_DOWN if 'database is down'.
 *
 *************************************************************************/
static int sql_fetch_row(SQLSOCK *sqlsocket, SQL_CONFIG *config) {

	rlm_sql_sybase_sock *sybase_sock = sqlsocket->conn;
    CS_RETCODE  ret;
	CS_INT		count;
    int         colcount;
    CS_INT      *colsize;
    char        **rowdata;
    int         i=0;

    rad_assert(sybase_sock != NULL);

	sqlsocket->row = NULL;

    colcount = sybase_sock->num_fields_cache;
    colsize = sybase_sock->field_size_cache;
    rowdata = sybase_sock->results;
    if(rowdata) {
        for(i=0; i<colcount; i++)
            memset(rowdata[i], 0, colsize[i]);
    }

	ret = ct_fetch(sybase_sock->command, CS_UNUSED, CS_UNUSED, CS_UNUSED, &count);

	switch (ret) {

	case CS_FAIL:

		/*
		** Serious failure, sybase requires us to cancel
		** the results and maybe even close the connection.
		*/

		radlog(L_ERROR|L_CONS, "[rlm_sql_sybase] fetch_row: "
               "Failure fething row data %s",
               sql_error(sqlsocket, config));
		if ((ret = ct_cancel(NULL, sybase_sock->command, CS_CANCEL_ALL)) == CS_FAIL) {
			radlog(L_ERROR|L_CONS, "[rlm_sql_sybase] fetch_row: "
                   "Fail to do ct_cancel(), close connection");
			sql_close(sqlsocket, config);
		}
		return -1;
		break;

	case CS_END_DATA:

		return 0;
		break;

	case CS_SUCCEED:

		sqlsocket->row = sybase_sock->results;
		return 0;
		break;

	case CS_ROW_FAIL:

		radlog(L_ERROR|L_CONS, "[rlm_sql_sybase] fetch_row: "
               "Recoverable failure fething row data, try again perhaps?");
		return -1;
        break;

	default:

		radlog(L_ERROR|L_CONS, "[rlm_sql_sybase] fetch_row: "
               "Unexpected returncode from ct_fetch");
		return -1;
		break;
	}

}

/*************************************************************************
 *
 *	Function: sql_free_result
 *
 *	Purpose: database specific free_result. Frees memory allocated
 *               for a result set
 *
 *************************************************************************/
static int sql_free_result(SQLSOCK *sqlsocket, SQL_CONFIG *config) {

	/*
	** Not implemented, never called from rlm_sql anyway
	** result buffer is freed in the finish_query functions.
	*/

	return 0;

}

/*************************************************************************
 *
 *	Function: sql_affected_rows
 *
 *	Purpose: Return the number of rows affected by the query (update,
 *               or insert)
 *
 *************************************************************************/
static int sql_affected_rows(SQLSOCK *sqlsocket, SQL_CONFIG *config) {

    rlm_sql_sybase_sock *sybase_sock = sqlsocket->conn;
    rad_assert(sybase_sock != NULL);

	// return sql_num_rows(sqlsocket, config);
    return sybase_sock->affected_rows_cache;
}

static void set_logging_parameter(LOG_CONFIG *logconfig)
{
    if(logconfig) {
        radlog_debug_flag = logconfig->log_debug_flag;
        radlog_level_hold = logconfig->log_level;
        radlog_dest = (radlog_dest_t)logconfig->log_dest;
        radlog_set_logfile(logconfig->log_file);
        radlog_print_millisec = logconfig->log_millisec;

        rad_start_heap_tracking();
    } else {
        rad_stop_heap_tracking();
    }
}

/* Exported to rlm_sql */
RAD_SYMBOL
rlm_sql_module_t rlm_sql_sybase = {
	"rlm_sql_sybase11",
	sql_init_socket,
	sql_destroy_socket,
	sql_query,
	sql_select_query,
	sql_store_result,
	sql_num_fields,
	sql_num_rows,
	sql_fetch_row,
	sql_free_result,
	sql_error,
	sql_close,
	sql_finish_query,
	sql_finish_select_query,
	sql_affected_rows,
    set_logging_parameter
};


text:
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var core_1 = require("@angular/core");
var http_1 = require("@angular/http");
var AppSettings_1 = require("../AppSettings");
var UserService = (function () {
    function UserService(http) {
        this.http = http;
    }
    UserService.prototype.getAll = function () {
        return this.http.get('/api/users', this.jwt()).map(function (response) { return response.json(); });
    };
    UserService.prototype.getById = function (id) {
        return this.http.get('/api/users/' + id, this.jwt()).map(function (response) { return response.json(); });
    };
    UserService.prototype.create = function (user) {
        var headers = new http_1.Headers({ 'Content-Type': 'application/json' });
        var body = JSON.stringify({ username: user.username, eMail: user.email, fullName: user.fullname, password: user.password, confirmPassword: user.confirmPassword });
        return this.http.post(AppSettings_1.AppSettings.API_URL + 'Account/Register', body, { headers: headers });
    };
    //update(user: RegisterModel) {
    //    return this.http.put('/api/users/' + user.id, user, this.jwt()).map((response: Response) => response.json());
    //}
    UserService.prototype.delete = function (id) {
        return this.http.delete('/api/users/' + id, this.jwt()).map(function (response) { return response.json(); });
    };
    // private helper methods
    UserService.prototype.jwt = function () {
        // create authorization header with jwt token
        var currentUser = JSON.parse(localStorage.getItem('auth_token'));
        if (currentUser && currentUser.token) {
            var headers = new http_1.Headers({ 'Authorization': 'Bearer ' + currentUser.token });
            return new http_1.RequestOptions({ headers: headers });
        }
    };
    return UserService;
}());
UserService = __decorate([
    core_1.Injectable(),
    __metadata("design:paramtypes", [http_1.Http])
], UserService);
exports.UserService = UserService;
//# sourceMappingURL=user.service.js.map


text:
require 'spec_helper'

describe MailTrack do

  describe "fetch_by" do

    it "finds the right one" do
      expect( MailTrack.add '777', 'email', 'daily', '1' ).to be_truthy

      expect( MailTrack.fetch_by('777', 'email', 'daily').count ).to eq(1)
      expect( MailTrack.send_already? '777', 'email', 'daily' ).to be_truthy
    end
    it "doesnt find because older than 24 hours" do
      yesterday = DateTime.now - 25.hours
      mt = MailTrack.new(:user_id => '777', :template => 'email', :period => 'daily', :project_id => '1', :created_at => yesterday)
      expect( mt.save ).to be_truthy

      expect( MailTrack.fetch_by('777', 'email', 'daily').count ).to eq(0)
      expect( MailTrack.send_already? '777', 'email', 'daily' ).to be_falsey
    end
    it "doesnt exist already" do
      expect( MailTrack.fetch_by('777', 'email', 'daily').count ).to eq(0)
      expect( MailTrack.send_already? '777', 'email', 'daily' ).to be_falsey
    end
    it "exist already for weekkly" do
      days_ago = DateTime.now - 2.days
      mt = MailTrack.new(:user_id => '777', :template => 'email', :period => 'weekly', :project_id => '1', :created_at => days_ago)
      expect( mt.save ).to be_truthy

      expect( MailTrack.fetch_by('777', 'email', 'weekly').count ).to eq(1)
      expect( MailTrack.send_already? '777', 'email', 'weekly' ).to be_truthy
    end
    it "exist already for monthly" do
      weeks_ago = DateTime.now - 3.weeks
      mt = MailTrack.new(:user_id => '777', :template => 'email', :period => 'monthly', :project_id => '1', :created_at => weeks_ago)
      expect( mt.save ).to be_truthy

      expect( MailTrack.fetch_by('777', 'email', 'monthly').count ).to eq(1)
      expect( MailTrack.send_already? '777', 'email', 'monthly' ).to be_truthy
    end

  end

end


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

<title>Uses of Class org.maltparser.parser.algorithm.nivre.NivreFactory (MaltParser 1.8.1)</title>
<meta name="date" content="2014-11-22">
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

MaltParser 1.8.1

Prev

Next

Frames

No Frames

All Classes

Uses of Class
org.maltparser.parser.algorithm.nivre.NivreFactory

Packages that use NivreFactory

Package
Description

org.maltparser.parser.algorithm.nivre

Implements the Nivre deterministic parsing algorithms.

Uses of NivreFactory in org.maltparser.parser.algorithm.nivre

Subclasses of NivreFactory in org.maltparser.parser.algorithm.nivre

Modifier and Type
Class and Description

class
NivreArcEagerFactory

class
NivreArcStandardFactory

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

MaltParser 1.8.1

Prev

Next

Frames

No Frames

All Classes

Copyright 2007-2014 Johan Hall, Jens Nilsson and Joakim Nivre.


text:
(function(){
	var _class =
	namespace("Pong.Models.Paddle",
	inherit(Pong.Models.Object2D,
	construct({

		static:{
			DEFAULT_WIDTH:32,
			DEFAULT_HEIGHT:128
		},

		instance:{
			__construct:function(){
				this.width = this.width || _class.DEFAULT_WIDTH;
				this.height = this.height || _class.DEFAULT_HEIGHT;
			}
		}

	})));
})();


text:
require 'rubygems'
require 'minitest/autorun'
require 'active_model'

# Coloring
require "minitest/reporters"
Minitest::Reporters.use!

require 'btc_address_validator'


text:
#ifndef _MESH_RENDER_NODE_H
#define _MESH_RENDER_NODE_H

// common implementation headers
#include "bzfgl.h"
#include "RenderNode.h"

class Extents;
class MeshDrawMgr;

class OpaqueRenderNode : public RenderNode {
  public:
    OpaqueRenderNode(MeshDrawMgr* drawMgr,
		     GLuint* xformList, bool normalize,
		     const GLfloat* color, int lod, int set,
		     const Extents* exts, int triangles);
    void render();
    void renderRadar();
    void renderShadow();
    virtual const GLfloat* getPosition() const { return NULL;}
  private:
    void drawV() const;
    void drawVN() const;
    void drawVT() const;
    void drawVTN() const;
  private:
    MeshDrawMgr* drawMgr;
    GLuint* xformList;
    bool normalize;
    int lod, set;
    const GLfloat* color;
    const Extents* exts;
    int triangles;
};

class AlphaGroupRenderNode : public OpaqueRenderNode {
  public:
    AlphaGroupRenderNode(MeshDrawMgr* drawMgr,
			 GLuint* xformList, bool normalize,
			 const GLfloat* color, int lod, int set,
			 const Extents* exts, const float pos[3],
			 int triangles);
    const GLfloat* getPosition() const { return pos; }
    void setPosition(const GLfloat* pos);
  private:
    float pos[3];
};

#endif // _MESH_RENDER_NODE_H

// Local Variables: ***
// mode:C++ ***
// tab-width: 8 ***
// c-basic-offset: 2 ***
// indent-tabs-mode: t ***
// End: ***
// ex: shiftwidth=2 tabstop=8


text:
sudo /bin/nginxify
sudo /etc/init.d/nginx reload


text:
<?php

namespace estvoyage\martinfowler\ioc\tests\units;

class test extends \atoum
{
	function beforeTestMethod($method)
	{
		$this->mockGenerator->allIsInterface();
	}
}


text:
    //
//  ArticleDetailViewController.m
//  Mood Diary
//
//  Created by 王振辉 on 15/7/4.
//  Copyright (c) 2015年 Mood Group. All rights reserved.
//

#import "ArticleDetailViewController.h"
#import "UIImageView+WebCache.h"
#import "DataModel.h"
#import "ArticleDetail.h"
#import "UMSocial.h"
@interface ArticleDetailViewController (){
    UIWebView *webView;
    NSInteger lastPosition;
    UIView *buttonView;
    UIButton *likeButton;
    UIButton *shareButton;
    UIButton *collectButton;
    BOOL buttonFlag;
    DataModel *_dataModel;
}

@end

@implementation ArticleDetailViewController
@synthesize frameheight;
@synthesize digest;
@synthesize likenumelabel;

- (void)viewDidLoad {
    [super viewDidLoad];
    _dataModel = [[DataModel alloc]init];
    [self initWebView];

    socialData = [[UMSocialData alloc] initWithIdentifier:[NSString stringWithFormat:@"%@%@",_url,_thumbnailURL]];
    socialDataService = [[UMSocialDataService alloc] initWithUMSocialData:socialData];

}

- (void)initWebView{

    self.view.backgroundColor = [UIColor colorWithRed:219.0/255.0 green:222.0/255.0 blue:221.0/255.0 alpha:1.0];
    webView = [[UIWebView alloc]initWithFrame:CGRectMake(0, upsideheight, SCREEN_WIDTH, frameheight)];
    NSURLRequest *request = [NSURLRequest requestWithURL:self.url];
    [self.view addSubview:webView];
    [webView loadRequest:request];
    webView.scrollView.delegate = self;
    self.automaticallyAdjustsScrollViewInsets = NO;
    buttonFlag = NO;
}

- (void)setButton{
    if (buttonFlag == 0) {
        buttonView = [[UIView alloc]initWithFrame:CGRectMake(SCREEN_WIDTH - 140 -5, frameheight+upsideheight-50, 140, 40)];
        buttonView.backgroundColor = [UIColor clearColor];

        likeButton = [[UIButton alloc]initWithFrame:CGRectMake(0, 1, 38, 38)];

        [likeButton setImage:[UIImage imageNamed:@"newunlike"] forState:UIControlStateNormal];
        [likeButton setImage:[UIImage imageNamed:@"newlike"] forState:UIControlStateSelected];

        [likeButton addTarget:self action:@selector(likeButtonTapped:) forControlEvents:UIControlEventTouchUpInside];
        [buttonView addSubview:likeButton];

        likenumelabel = [[UILabel alloc]initWithFrame:CGRectMake(12, 14, 20, 20)];
        [likeButton addSubview:likenumelabel];
        likenumelabel.adjustsFontSizeToFitWidth = YES;
        likenumelabel.backgroundColor = [UIColor clearColor];
        likenumelabel.textColor = [UIColor whiteColor];
        likenumelabel.textAlignment = NSTextAlignmentCenter;

        [socialDataService requestSocialDataWithCompletion:^(UMSocialResponseEntity *response){
            // 下面的方法可以获取保存在本地的评论数,如果app重新安装之后,数据会被清空,可能获取值为0
            NSInteger likeNumber = [socialDataService.socialData getNumber:UMSNumberLike];
            likenumelabel.text = [NSString stringWithFormat:@"%ld",(long)likeNumber];
            NSLog(@"likeNum is %ld",(long)likeNumber);
        }];

        islike = socialData.isLike;

        if (islike) {
            likeButton.selected = YES;
        }
        else{
            likeButton.selected = NO;
        }

        NSLog(@"collectButtonTapped");
        ArticleDetail *articlDetail = [[ArticleDetail alloc]init];
        articlDetail.thumbnailURL = _thumbnailURL;
        articlDetail.titleString = _titleString;
        articlDetail.dateString = _dateString;
        articlDetail.articleURL = _url;
        articlDetail.IDString = _IDString;
        articlDetail.digest = digest;

        BOOL flag;
        flag = [_dataModel addObject:articlDetail];

        collectButton = [[UIButton alloc]initWithFrame:CGRectMake(50, 0, 40, 40)];
        [collectButton setImage:[UIImage imageNamed:@"newuncollect"] forState:UIControlStateNormal];
        [collectButton setImage:[UIImage imageNamed:@"newcollect"] forState:UIControlStateSelected];
        [collectButton addTarget:self action:@selector(collectButtonTapped:) forControlEvents:UIControlEventTouchUpInside];
        if (flag == 1) {
            //未收藏
            collectButton.selected = NO;
        }
        else{
            collectButton.selected = YES;
        }
        [buttonView addSubview:collectButton];

        flag = [_dataModel addObject:articlDetail];

        shareButton = [[UIButton alloc]initWithFrame:CGRectMake(100, 0, 40, 40)];
        [shareButton setImage:[UIImage imageNamed:@"newshare"] forState:UIControlStateNormal];
        [shareButton setImage:[UIImage imageNamed:@"newunshare"] forState:UIControlStateSelected];
        [shareButton addTarget:self action:@selector(shareButtonTapped:) forControlEvents:UIControlEventTouchUpInside];
        [buttonView addSubview:shareButton];

        [self.view addSubview:buttonView];
    }else{
        [buttonView removeFromSuperview];
    }
    buttonFlag = !buttonFlag;
}

#pragma mark - ScrollViewDelegate
- (void)scrollViewDidScroll:(UIScrollView *)scrollView{
    NSInteger currentPosition = webView.scrollView.contentOffset.y;
    if (currentPosition - lastPosition >25) {
        if (buttonFlag == 1) {
            [self setButton];
        }
        lastPosition = currentPosition;
    }else if( lastPosition - currentPosition >25 ){
        if (buttonFlag == 0) {
            [self setButton];
        }
        lastPosition = currentPosition;
    }
}

#pragma mark - ButtonTapped
- (void)likeButtonTapped:(id)sender{

    //把你的文章或者音乐的标识,作为@"identifier"

    islike = socialData.isLike;

    if (islike) {
        likeButton.selected = NO;
    }
    else{
        likeButton.selected = YES;
    }

    [socialDataService postAddLikeOrCancelWithCompletion:^(UMSocialResponseEntity *response){
        //获取请求结果
        NSLog(@"resposne is %@",response);
    }];

    [socialDataService requestSocialDataWithCompletion:^(UMSocialResponseEntity *response){
        // 下面的方法可以获取保存在本地的评论数,如果app重新安装之后,数据会被清空,可能获取值为0
        NSInteger likeNumber = [socialDataService.socialData getNumber:UMSNumberLike];
        likenumelabel.text = [NSString stringWithFormat:@"%ld",(long)likeNumber];
        NSLog(@"likeNum is %ld",(long)likeNumber);
    }];

    NSLog(@"likeButtonTapped");
}

- (void)collectButtonTapped:(id)sender{

    NSLog(@"collectButtonTapped");
    ArticleDetail *articlDetail = [[ArticleDetail alloc]init];
    articlDetail.thumbnailURL = _thumbnailURL;
    articlDetail.titleString = _titleString;
    articlDetail.dateString = _dateString;
    articlDetail.articleURL = _url;
    articlDetail.IDString = _IDString;
    articlDetail.digest = digest;

    BOOL flag;
    flag = [_dataModel addObject:articlDetail];

    if (flag == 1) {
        collectButton.selected = YES;
        [self.view showResult:ResultViewTypeOK text:@"收藏成功"];
        NSLog(@"已收藏");
    }else{
        NSLog(@"已取消收藏");
        collectButton.selected = NO;
        [self.view showResult:ResultViewTypeOK text:@"取消收藏"];
    }

    [_dataModel saveArticles];
}

- (void)shareButtonTapped:(id)sender{
    NSArray *sharearr = [NSArray arrayWithObjects:UMShareToWechatSession,UMShareToWechatTimeline,UMShareToQzone,UMShareToSina,UMShareToQQ,nil];

    NSData * data = [NSData dataWithContentsOfURL:_thumbnailURL];

    //设置点击分享内容跳转链接qq
    [UMSocialData defaultData].extConfig.qqData.url = [NSString stringWithFormat:@"%@",_url];

    //设置点击分享内容跳转链接qq空间
    [UMSocialData defaultData].extConfig.qzoneData.url = [NSString stringWithFormat:@"%@",_url];

    //设置分享标题qq
    [UMSocialData defaultData].extConfig.qqData.title = [NSString stringWithFormat:@"%@",_titleString];

    //设置分享标题qq空间
    [UMSocialData defaultData].extConfig.qzoneData.title = [NSString stringWithFormat:@"%@",_titleString];

    //设置分享平台
    [UMSocialSnsService presentSnsIconSheetView:self
                                         appKey:UmengAppkey
                                      shareText:[NSString stringWithFormat:@"%@  (分享自心情日记iOS客户端) %@",digest,_url]
                                     shareImage:[UIImage imageWithData:data]
                                shareToSnsNames:sharearr
                                       delegate:self];

    //设置微信和朋友圈跳转链接
    [UMSocialData defaultData].extConfig.wechatSessionData.url = [NSString stringWithFormat:@"%@",_url];

    [UMSocialData defaultData].extConfig.wechatTimelineData.url = [NSString stringWithFormat:@"%@",_url];

    [UMSocialData defaultData].extConfig.wechatSessionData.title = [NSString stringWithFormat:@"%@",_titleString];

    [UMSocialData defaultData].extConfig.wechatTimelineData.title = [NSString stringWithFormat:@"%@",_titleString];

            [UMSocialConfig setFollowWeiboUids:@{UMShareToSina:@"3214415900"}];

            [[UMSocialDataService defaultDataService] requestAddFollow:UMShareToSina followedUsid:@[@"2091897557"] completion:nil];

}

-(void)didFinishGetUMSocialDataInViewController:(UMSocialResponseEntity *)response
{
    //根据responseCode得到发送结果,如果分享成功
    if(response.responseCode == UMSResponseCodeSuccess)
    {
        //得到分享到的微博平台名
        NSLog(@"share to sns name is %@",[[response.data allKeys] objectAtIndex:0]);
        [self.view showResult:ResultViewTypeOK text:[NSString stringWithFormat:@"分享成功"]];
    }
    else{
        [self.view showResult:ResultViewTypeFaild text:@"分享失败,请检查分享内容或重新授权"];
    }
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end


text:
from mitmproxy.addons import anticache
from mitmproxy.addons import anticomp
from mitmproxy.addons import check_alpn
from mitmproxy.addons import check_ca
from mitmproxy.addons import clientplayback
from mitmproxy.addons import disable_h2c_upgrade
from mitmproxy.addons import onboarding
from mitmproxy.addons import proxyauth
from mitmproxy.addons import replace
from mitmproxy.addons import script
from mitmproxy.addons import serverplayback
from mitmproxy.addons import setheaders
from mitmproxy.addons import stickyauth
from mitmproxy.addons import stickycookie
from mitmproxy.addons import streambodies
from mitmproxy.addons import streamfile
from mitmproxy.addons import upstream_auth

def default_addons():
    return [
        anticache.AntiCache(),
        anticomp.AntiComp(),
        check_alpn.CheckALPN(),
        check_ca.CheckCA(),
        clientplayback.ClientPlayback(),
        disable_h2c_upgrade.DisableH2CleartextUpgrade(),
        onboarding.Onboarding(),
        proxyauth.ProxyAuth(),
        replace.Replace(),
        replace.ReplaceFile(),
        script.ScriptLoader(),
        serverplayback.ServerPlayback(),
        setheaders.SetHeaders(),
        stickyauth.StickyAuth(),
        stickycookie.StickyCookie(),
        streambodies.StreamBodies(),
        streamfile.StreamFile(),
        upstream_auth.UpstreamAuth(),
    ]


text:
<link rel="stylesheet" href="<?php echo site_url(); ?>/application/resources/css/lib/summernote/summernote.css"/>

				<button type="button" class="modal-close" data-dismiss="modal" aria-label="Close">

				</button>

Добавить продукт

			<form class="form-horizontal mt25 ml50" action="/admin_panel/faq" method="POST"   enctype="multipart/form-data">

						Вопрос
						<input type="text" class='form-control' name="question" value="" placeholder="вопрос">

						Категории
						<select name='category' class="selectpicker">
							<option value="Наша продукция">Наша продукция</option>
							<option value="Как заказать">Как заказать</option>
							<option value='Доставка и оплата'>Доставка и оплата</option>
							<option value="Документы">Документы</option>
						</select>

						Описание

							<textarea class="summernote" name='answer'></textarea>

					<input id="<?php echo $csrf_token_name; ?>" type="hidden" value="<?php echo $csrf_hash; ?>" name="<?php echo $csrf_token_name; ?>">
					<button type="button" class="btn btn-rounded btn-default" data-dismiss="modal">Закрыть</button>
					<button type="submit"  class="btn btn-rounded btn-primary">Сохранить</button>

			</form>

		<button class='btn btn-inline btn-primary-outline' data-toggle='modal' data-target='#addProduct'>Добавить вопрос-ответ</button>

Список вопросов

								№
								Вопрос
								Ответ
								Категория
								Дата

							<?php
							$i = 1;
							foreach($data['faq'] AS $faq) { ?>

									<?php echo $i; ?>
									<?php echo $faq['question']; ?>
									<?php echo $faq['answer']; ?>
									<?php echo $faq['category']; ?>
									 <?php echo date('Y-m-d', strtotime($faq['date'])); ?>

										<a data-toggle='modal' data-target='#editFaq<?php echo $faq['id']; ?>'>

										<a href="/admin_panel/delete_faq/<?php echo $faq['id']; ?>" onclick="return window.confirm('Вы уверены?')">

								<div id="editFaq<?php echo $faq['id']; ?>" class="modal fade" role="dialog">

												<button type="button" class="modal-close" data-dismiss="modal" aria-label="Close">

												</button>

Редактировать Вопрос-ответ

											<form class="form-horizontal mt25 ml50" action="/admin_panel/edit_faq" method="POST"   enctype="multipart/form-data">

														Вопрос
														<input type="text" class='form-control' name="question" value="<?php echo $faq['question'] ?>">

														Категории
														<select name='category' class="">
															<option value="Наша продукция">Наша продукция</option>
															<option value="Как заказать">Как заказать</option>
															<option value='Доставка и оплата'>Доставка и оплата</option>
															<option value="Документы">Документы</option>
														</select>

														Ответ

															<textarea class="summernote" name='answer'><?php echo $faq['answer']; ?></textarea>

													<input id="<?php echo $csrf_token_name; ?>" type="hidden" value="<?php echo $csrf_hash; ?>" name="<?php echo $csrf_token_name; ?>">
													<input type='hidden' name='id' value="<?php echo $faq['id'] ?>">
													<button type="button" class="btn btn-rounded btn-default" data-dismiss="modal">Закрыть</button>
													<button type="submit" class="btn btn-rounded btn-primary">Сохранить</button>

											</form>

								<?php
								$i++;
							} ?>


text:
"use strict";
/* jshint undef: false */

var parser = require('can-view-parser');
var viewCallbacks = require('can-view-callbacks');

var HTMLSectionBuilder = require('./src/html_section');
var TextSectionBuilder = require('./src/text_section');
var mustacheCore = require('./src/mustache_core');
var mustacheHelpers = require('./helpers/core');
var getIntermediateAndImports = require('can-stache-ast').parse;
var utils = require('./src/utils');
var makeRendererConvertScopes = utils.makeRendererConvertScopes;
var last = utils.last;

var attributeEncoder = require('can-attribute-encoder');
var dev = require('can-log/dev/dev');
var namespace = require('can-namespace');
var DOCUMENT = require('can-globals/document/document');
var assign = require('can-assign');
var importer = require('can-import-module');
var canReflect = require('can-reflect');
var Scope = require('can-view-scope');
var TemplateContext = require("can-view-scope/template-context");
var ObservationRecorder = require('can-observation-recorder');
var canSymbol = require("can-symbol");
// Make sure that we can also use our modules with Stache as a plugin

require('can-view-target');

if(!viewCallbacks.tag("content")) {
	// This was moved from the legacy view/scanner.js to here.
	// This makes sure content elements will be able to have a callback.
	viewCallbacks.tag("content", function(el, tagData) {
		return tagData.scope;
	});
}

var isViewSymbol = canSymbol.for("can.isView");

var wrappedAttrPattern = /[{(].*[)}]/;
var colonWrappedAttrPattern = /^on:|(:to|:from|:bind)$|.*:to:on:.*/;
var svgNamespace = "http://www.w3.org/2000/svg",
xmlnsAttrNamespaceURI = "http://www.w3.org/2000/xmlns/",
xlinkHrefAttrNamespaceURI =  "http://www.w3.org/1999/xlink";
var namespaces = {
	"svg": svgNamespace,
	// this allows a partial to start with g.
	"g": svgNamespace,
	"defs": svgNamespace,
	"path": svgNamespace,
	"filter": svgNamespace,
	"feMorphology": svgNamespace,
	"feGaussianBlur": svgNamespace,
	"feOffset": svgNamespace,
	"feComposite": svgNamespace,
	"feColorMatrix": svgNamespace,
	"use": svgNamespace
},
	attrsNamespacesURI = {
		'xmlns': xmlnsAttrNamespaceURI,
		'xlink:href': xlinkHrefAttrNamespaceURI
	},
	textContentOnlyTag = {style: true, script: true};

function stache (filename, template) {
	if (arguments.length === 1) {
		template = arguments[0];
		filename = undefined;
	}

	var inlinePartials = {};

	// Remove line breaks according to mustache's specs.
	if(typeof template === "string") {
		template = mustacheCore.cleanWhitespaceControl(template);
		template = mustacheCore.cleanLineEndings(template);
	}

	// The HTML section that is the root section for the entire template.
	var section = new HTMLSectionBuilder(filename),
		// Tracks the state of the parser.
		state = {
			node: null,
			attr: null,
			// A stack of which node / section we are in.
			// There is probably a better way of doing this.
			sectionElementStack: [],
			// If text should be inserted and HTML escaped
			text: false,
			// which namespace we are in
			namespaceStack: [],
			// for style and script tags
			// we create a special TextSectionBuilder and add things to that
			// when the element is done, we compile the text section and
			// add it as a callback to `section`.
			textContentOnly: null

		},

		// This function is a catch all for taking a section and figuring out
		// how to create a "renderer" that handles the functionality for a
		// given section and modify the section to use that renderer.
		// For example, if an HTMLSection is passed with mode `#` it knows to
		// create a liveBindingBranchRenderer and pass that to section.add.
		// jshint maxdepth:5
		makeRendererAndUpdateSection = function(section, mode, stache, lineNo){

			if(mode === ">") {
				// Partials use liveBindingPartialRenderers
				section.add(mustacheCore.makeLiveBindingPartialRenderer(stache, copyState({ filename: section.filename, lineNo: lineNo })));

			} else if(mode === "/") {

				var createdSection = section.last();
				if ( createdSection.startedWith === "<" ) {
					inlinePartials[ stache ] = section.endSubSectionAndReturnRenderer();
					// Remove *TWO* nodes because we now have a start and an end comment for the section....
					section.removeCurrentNode();
					section.removeCurrentNode();
				} else {
					section.endSection();
				}

				// to avoid "Blocks are nested too deeply" when linting
				//!steal-remove-start
				if (process.env.NODE_ENV !== 'production') {
					if(section instanceof HTMLSectionBuilder) {
						var last = state.sectionElementStack[state.sectionElementStack.length - 1];
						if (last.tag && last.type === "section" && stache !== "" && stache !== last.tag) {
							if (filename) {
								dev.warn(filename + ":" + lineNo + ": unexpected closing tag {{/" + stache + "}} expected {{/" + last.tag + "}}");
							}
							else {
								dev.warn(lineNo + ": unexpected closing tag {{/" + stache + "}} expected {{/" + last.tag + "}}");
							}
						}
					}
				}
				//!steal-remove-end

				if(section instanceof HTMLSectionBuilder) {
					state.sectionElementStack.pop();
				}
			} else if(mode === "else") {

				section.inverse();

			} else {

				// If we are an HTMLSection, we will generate a
				// a LiveBindingBranchRenderer; otherwise, a StringBranchRenderer.
				// A LiveBindingBranchRenderer function processes
				// the mustache text, and sets up live binding if an observable is read.
				// A StringBranchRenderer function processes the mustache text and returns a
				// text value.
				var makeRenderer = section instanceof HTMLSectionBuilder ?
					mustacheCore.makeLiveBindingBranchRenderer:
					mustacheCore.makeStringBranchRenderer;

				if(mode === "{" || mode === "&") {

					// Adds a renderer function that just reads a value or calls a helper.
					section.add(makeRenderer(null,stache, copyState({ filename: section.filename, lineNo: lineNo })));

				} else if(mode === "#" || mode === "^" || mode === "<") {
					// Adds a renderer function and starts a section.
					var renderer = makeRenderer(mode, stache, copyState({ filename: section.filename, lineNo: lineNo }));
					var sectionItem = {
						type: "section"
					};
					section.startSection(renderer, stache);
					section.last().startedWith = mode;

					// If we are a directly nested section, count how many we are within
					if(section instanceof HTMLSectionBuilder) {
						//!steal-remove-start
						if (process.env.NODE_ENV !== 'production') {
							var tag = typeof renderer.exprData.closingTag === 'function' ?
								renderer.exprData.closingTag() : stache;
							sectionItem.tag = tag;
						}
						//!steal-remove-end

						state.sectionElementStack.push(sectionItem);
					}
				} else {
					// Adds a renderer function that only updates text.
					section.add(makeRenderer(null, stache, copyState({text: true, filename: section.filename, lineNo: lineNo })));
				}

			}
		},
		isDirectlyNested = function() {
			var lastElement = state.sectionElementStack[state.sectionElementStack.length - 1];
			return state.sectionElementStack.length ?
				lastElement.type === "section" || lastElement.type === "custom": true;
		},
		// Copys the state object for use in renderers.
		copyState = function(overwrites){

			var cur = {
				tag: state.node && state.node.tag,
				attr: state.attr && state.attr.name,
				// <content> elements should be considered direclty nested
				directlyNested: isDirectlyNested(),
				textContentOnly: !!state.textContentOnly
			};
			return overwrites ? assign(cur, overwrites) : cur;
		},
		addAttributesCallback = function(node, callback){
			if( !node.attributes ) {
				node.attributes = [];
			}
			node.attributes.unshift(callback);
		};

	parser(template, {
		filename: filename,
		start: function(tagName, unary, lineNo){
			var matchedNamespace = namespaces[tagName];

			if (matchedNamespace && !unary ) {
				state.namespaceStack.push(matchedNamespace);
			}

			// either add templates: {} here or check below and decorate
			// walk up the stack/targetStack until you find the first node
			// with a templates property, and add the popped renderer
			state.node = {
				tag: tagName,
				children: [],
				namespace: matchedNamespace || last(state.namespaceStack)
			};
		},
		end: function(tagName, unary, lineNo){
			var isCustomTag =  viewCallbacks.tag(tagName);
			var directlyNested = isDirectlyNested();
			if(unary){
				// If it's a custom tag with content, we need a section renderer.
				section.add(state.node);
				if(isCustomTag) {
					// Call directlyNested now as it's stateful.
					addAttributesCallback(state.node, function(scope){
						//!steal-remove-start
						if (process.env.NODE_ENV !== 'production') {
							scope.set('scope.lineNumber', lineNo);
						}
						//!steal-remove-end
						viewCallbacks.tagHandler(this,tagName, {
							scope: scope,
							subtemplate: null,
							templateType: "stache",
							directlyNested: directlyNested
						});
					});
				}
			} else {
				section.push(state.node);

				state.sectionElementStack.push({
					type: isCustomTag ? "custom" : null,
					tag: isCustomTag ? null : tagName,
					templates: {},
					directlyNested: directlyNested
				});

				// If it's a custom tag with content, we need a section renderer.
				if( isCustomTag ) {
					section.startSubSection();
				} else if(textContentOnlyTag[tagName]) {
					state.textContentOnly = new TextSectionBuilder(filename);
				}
			}

			state.node =null;

		},
		close: function(tagName, lineNo) {
			var matchedNamespace = namespaces[tagName];

			if (matchedNamespace  ) {
				state.namespaceStack.pop();
			}

			var isCustomTag = viewCallbacks.tag(tagName),
				renderer;

			if( isCustomTag ) {
				renderer = section.endSubSectionAndReturnRenderer();
			}

			if(textContentOnlyTag[tagName]) {
				section.last().add(state.textContentOnly.compile(copyState()));
				state.textContentOnly = null;
			}

			var oldNode = section.pop();
			if( isCustomTag ) {
				if (tagName === "can-template") {
					// If we find a can-template we want to go back 2 in the stack to get it's inner content
					// rather than the <can-template> element itself
					var parent = state.sectionElementStack[state.sectionElementStack.length - 2];
					if (renderer) {// Only add the renderer if the template has content
						parent.templates[oldNode.attrs.name] = makeRendererConvertScopes(renderer);
					}
					section.removeCurrentNode();
				} else {
					// Get the last element in the stack
					var current = state.sectionElementStack[state.sectionElementStack.length - 1];
					addAttributesCallback(oldNode, function(scope){
						//!steal-remove-start
						if (process.env.NODE_ENV !== 'production') {
							scope.set('scope.lineNumber', lineNo);
						}
						//!steal-remove-end
						viewCallbacks.tagHandler(this,tagName, {
							scope: scope,
							subtemplate: renderer  ? makeRendererConvertScopes(renderer) : renderer,
							templateType: "stache",
							templates: current.templates,
							directlyNested: current.directlyNested
						});
					});
				}
			}
			state.sectionElementStack.pop();
		},
		attrStart: function(attrName, lineNo){
			if(state.node.section) {
				state.node.section.add(attrName+"=\"");
			} else {
				state.attr = {
					name: attrName,
					value: ""
				};
			}

		},
		attrEnd: function(attrName, lineNo){
			var matchedAttrNamespacesURI = attrsNamespacesURI[attrName];
			if(state.node.section) {
				state.node.section.add("\" ");
			} else {
				if(!state.node.attrs) {
					state.node.attrs = {};
				}

				if (state.attr.section) {
					state.node.attrs[state.attr.name] = state.attr.section.compile(copyState());
				} else if (matchedAttrNamespacesURI) {
					state.node.attrs[state.attr.name] = {
						value: state.attr.value,
						namespaceURI: attrsNamespacesURI[attrName]
					};
				} else {
					state.node.attrs[state.attr.name] = state.attr.value;
				}

				var attrCallback = viewCallbacks.attr(attrName);

				//!steal-remove-start
				if (process.env.NODE_ENV !== 'production') {
					var decodedAttrName = attributeEncoder.decode(attrName);
					var weirdAttribute = !!wrappedAttrPattern.test(decodedAttrName) || !!colonWrappedAttrPattern.test(decodedAttrName);
					if (weirdAttribute && !attrCallback) {
						dev.warn("unknown attribute binding " + decodedAttrName + ". Is can-stache-bindings imported?");
					}
				}
				//!steal-remove-end

				if(attrCallback) {
					if( !state.node.attributes ) {
						state.node.attributes = [];
					}
					state.node.attributes.push(function(scope){
						//!steal-remove-start
						if (process.env.NODE_ENV !== 'production') {
							scope.set('scope.lineNumber', lineNo);
						}
						//!steal-remove-end
						attrCallback(this,{
							attributeName: attrName,
							scope: scope
						});
					});
				}

				state.attr = null;
			}
		},
		attrValue: function(value, lineNo){
			var section = state.node.section || state.attr.section;
			if(section){
				section.add(value);
			} else {
				state.attr.value += value;
			}
		},
		chars: function(text, lineNo) {
			(state.textContentOnly || section).add(text);
		},
		special: function(text, lineNo){
			var firstAndText = mustacheCore.splitModeFromExpression(text, state),
				mode = firstAndText.mode,
				expression = firstAndText.expression;

			if(expression === "else") {
				var inverseSection;
				if(state.attr && state.attr.section) {
					inverseSection = state.attr.section;
				} else if(state.node && state.node.section ) {
					inverseSection = state.node.section;
				} else {
					inverseSection = state.textContentOnly || section;
				}
				inverseSection.inverse();
				return;
			}

			if(mode === "!") {
				return;
			}

			if(state.node && state.node.section) {

				makeRendererAndUpdateSection(state.node.section, mode, expression, lineNo);

				if(state.node.section.subSectionDepth() === 0){
					state.node.attributes.push( state.node.section.compile(copyState()) );
					delete state.node.section;
				}

			}
			// `{{}}` in an attribute like `class="{{}}"`
			else if(state.attr) {

				if(!state.attr.section) {
					state.attr.section = new TextSectionBuilder(filename);
					if(state.attr.value) {
						state.attr.section.add(state.attr.value);
					}
				}
				makeRendererAndUpdateSection(state.attr.section, mode, expression, lineNo);

			}
			// `{{}}` in a tag like `<div {{}}>`
			else if(state.node) {

				if(!state.node.attributes) {
					state.node.attributes = [];
				}
				if(!mode) {
					state.node.attributes.push(mustacheCore.makeLiveBindingBranchRenderer(null, expression, copyState({ filename: section.filename, lineNo: lineNo })));
				} else if( mode === "#" || mode === "^" ) {
					if(!state.node.section) {
						state.node.section = new TextSectionBuilder(filename);
					}
					makeRendererAndUpdateSection(state.node.section, mode, expression, lineNo);
				} else {
					throw new Error(mode+" is currently not supported within a tag.");
				}
			}
			else {
				makeRendererAndUpdateSection(state.textContentOnly || section, mode, expression, lineNo);
			}
		},
		comment: function(text) {
			// create comment node
			section.add({
				comment: text
			});
		},
		done: function(lineNo){
			//!steal-remove-start
			// warn if closing magic tag is missed #675
			if (process.env.NODE_ENV !== 'production') {
				var last = state.sectionElementStack[state.sectionElementStack.length - 1];
				if (last && last.tag && last.type === "section") {
					if (filename) {
						dev.warn(filename + ":" + lineNo + ": closing tag {{/" + last.tag + "}} was expected");
					}
					else {
						dev.warn(lineNo + ": closing tag {{/" + last.tag + "}} was expected");
					}
				}
			}
			//!steal-remove-end
		}
	});

	var renderer = section.compile();

	var scopifiedRenderer = ObservationRecorder.ignore(function(scope, options){
		// if an object is passed to options, assume it is the helpers object
		if (options && !options.helpers && !options.partials && !options.tags) {
			options = {
				helpers: options
			};
		}
		// mark passed in helper so they will be automatically passed
		// helperOptions (.fn, .inverse, etc) when called as Call Expressions
		canReflect.eachKey(options && options.helpers, function(helperValue) {
			helperValue.requiresOptionsArgument = true;
		});

		// helpers, partials, tags, vars
		var templateContext = new TemplateContext(options);

		// copy inline partials over
		canReflect.eachKey(inlinePartials, function(partial, partialName) {
			canReflect.setKeyValue(templateContext.partials, partialName, partial);
		});

		// allow the current renderer to be called with {{>scope.view}}
		canReflect.setKeyValue(templateContext, 'view', scopifiedRenderer);
		//!steal-remove-start
		if (process.env.NODE_ENV !== 'production') {
			canReflect.setKeyValue(templateContext, 'filename', section.filename);
		}
		//!steal-remove-end

		// now figure out the final structure ...
		if ( !(scope instanceof Scope) ) {
			scope = new Scope(templateContext).add(scope);
		} else {
			// we are going to split ...
			var templateContextScope = new Scope(templateContext);
			templateContextScope._parent = scope._parent;
			scope._parent = templateContextScope;
		}

		return renderer(scope.addLetContext());
	});

	// Identify is a view type
	scopifiedRenderer[isViewSymbol] = true;

	return scopifiedRenderer;
}

// At this point, can.stache has been created
assign(stache, mustacheHelpers);

stache.safeString = function(text){

	return canReflect.assignSymbols({},{
		"can.toDOM": function(){
			return text;
		}
	});
};
stache.async = function(source){
	var iAi = getIntermediateAndImports(source);
	var importPromises = iAi.imports.map(function(moduleName){
		return importer(moduleName);
	});
	return Promise.all(importPromises).then(function(){
		return stache(iAi.intermediate);
	});
};
var templates = {};
stache.from = mustacheCore.getTemplateById = function(id){
	if(!templates[id]) {
		var el = DOCUMENT().getElementById(id);
		if(el) {
			templates[id] = stache("#" + id, el.innerHTML);
		}
	}
	return templates[id];
};

stache.registerPartial = function(id, partial) {
	templates[id] = (typeof partial === "string" ? stache(partial) : partial);
};

stache.addBindings = viewCallbacks.attrs;

module.exports = namespace.stache = stache;


text:
'use strict';

/**
 * Class representing a ImportSourceCredentials.
 */
class ImportSourceCredentials {
  /**
   * Create a ImportSourceCredentials.
   * @property {string} [username] The username to authenticate with the source
   * registry.
   * @property {string} password The password used to authenticate with the
   * source registry.
   */
  constructor() {
  }

  /**
   * Defines the metadata of ImportSourceCredentials
   *
   * @returns {object} metadata of ImportSourceCredentials
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'ImportSourceCredentials',
      type: {
        name: 'Composite',
        className: 'ImportSourceCredentials',
        modelProperties: {
          username: {
            required: false,
            serializedName: 'username',
            type: {
              name: 'String'
            }
          },
          password: {
            required: true,
            serializedName: 'password',
            type: {
              name: 'String'
            }
          }
        }
      }
    };
  }
}

module.exports = ImportSourceCredentials;


text:
package com.taobao.tddl.client;

import java.util.Map;

/**
 * 别太纠结这混乱的包定义,一切都是为了以前老的客户端package定义
 *
 * @author jianghang 2014-6-13 上午9:57:18
 * @since 5.1.0
 */
public interface RouteCondition {

    public enum ROUTE_TYPE {
        /** 连接关闭的时候清空 */
        FLUSH_ON_CLOSECONNECTION,
        /** 执行完成时就清空 */
        FLUSH_ON_EXECUTE;
    }

    public String getVirtualTableName();

    public void setVirtualTableName(String virtualTableName);

    public ROUTE_TYPE getRouteType();

    public void setRouteType(ROUTE_TYPE routeType);

    public Map<String, Object> getExtraCmds();
}


text:
<?php

namespace NetSuite\Classes;

class BillingScheduleRecurrenceList {
    public $billingScheduleRecurrence;
    public $replaceAll;
    static $paramtypesmap = array(
        "billingScheduleRecurrence" => "BillingScheduleRecurrence[]",
        "replaceAll" => "boolean",
    );
}


text:
package com.wangjie.wavecompat;

import android.graphics.*;
import android.support.annotation.NonNull;
import android.view.animation.DecelerateInterpolator;
import com.nineoldandroids.animation.Animator;
import com.nineoldandroids.animation.AnimatorListenerAdapter;
import com.nineoldandroids.animation.ValueAnimator;

/**
 * Author: wangjie
 * Email: tiantian.china.2@gmail.com
 * Date: 5/29/15.
 */
public class WaveDrawable extends WaveDrawableBase {
    private OnWaveDrawableListener onWaveDrawableListener;

    @Override
    public void setOnWaveDrawableListener(OnWaveDrawableListener onWaveDrawableListener) {
        this.onWaveDrawableListener = onWaveDrawableListener;
    }

    private int width;
    private int height;
    private Point touchPoint;
    private Paint paint;

    private static final long DEFAULT_ANIMATION_DURATION = 200l;
    private long animationDuration = DEFAULT_ANIMATION_DURATION;

    public WaveDrawable setColor(int color) {
        paint.setColor(color);
        return this;
    }

    private int radius;
    private int currentRadius;

    private Bitmap frameBitmap;

    public WaveDrawable() {
        init();
    }

    private void init() {
        paint = new Paint();
        paint.setAntiAlias(true);
        paint.setColor(Color.GRAY);
    }

    private PorterDuffXfermode mProPorterDuffXfermode = new PorterDuffXfermode(PorterDuff.Mode.SRC_OVER);

    @Override
    protected void onBoundsChange(Rect bounds) {
        super.onBoundsChange(bounds);
        if ((width = bounds.right - bounds.left) > 0 && (height = bounds.bottom - bounds.top) > 0) {
            invalidateSelf();

            if (null == touchPoint) {
                touchPoint = new Point(width, height);
            }

            setTouchPoint(touchPoint);

            startWaveAnimator();
        }
    }

    public void startWaveAnimator() {
        if (null != onWaveDrawableListener) {
            onWaveDrawableListener.onWaveDrawableAnimatorStart();
        }
        if (waveAnimator.isRunning()) {
            waveAnimator.end();
        }
        waveAnimator.removeAllUpdateListeners();

        waveAnimator.setIntValues(0, radius);
        waveAnimator.setDuration(animationDuration);
        waveAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator animation) {
                currentRadius = (int) animation.getAnimatedValue();
                invalidateSelf();
            }
        });
        waveAnimator.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                super.onAnimationEnd(animation);
                if (null != onWaveDrawableListener) {
                    onWaveDrawableListener.onWaveDrawableAnimatorEnd();
                }
            }
        });
        waveAnimator.setInterpolator(new DecelerateInterpolator());
        waveAnimator.start();
    }

    @Override
    public void draw(Canvas canvas) {
        canvas.drawColor(Color.TRANSPARENT);
        paint.setXfermode(null);
        if (null != frameBitmap) {
            canvas.drawBitmap(frameBitmap, 0, 0, paint);
        }
        paint.setXfermode(mProPorterDuffXfermode);
        if (null != touchPoint) {
            canvas.drawCircle(touchPoint.x, touchPoint.y, currentRadius, paint);
        }
    }

    public WaveDrawable setTouchPoint(int x, int y) {
        return this.setTouchPoint(new Point(x, y));
    }

    public WaveDrawable setTouchPoint(@NonNull Point point) {
        this.touchPoint = point;
        int xx = Math.max(point.x, width - point.x);
        int yy = Math.max(point.y, height - point.y);
        radius = (int) Math.sqrt(xx * xx + yy * yy);
        return this;
    }

    private ValueAnimator waveAnimator = new ValueAnimator();

    public WaveDrawable setFrameBitmap(Bitmap frameBitmap) {
        this.frameBitmap = frameBitmap;
        return this;
    }

    public void setAnimationDuration(long animationDuration) {
        this.animationDuration = animationDuration;
    }
}


text:
import {MobxTranslate} from 'mobx-translate';

export  interface Dictionary {
    LAYOUT: {
        TITLE
        SEARCH
        POST_A_JOB
        ENTER_QUERY
        HOME
        LOGIN
        SEEMORE
        LOCATION
        POSITION
        COMPANY
        OPTIONS
        PROFILE
        EDIT
    }
}

export const EN : Dictionary = {
    LAYOUT: {
        POST_A_JOB: "Post a Job",
        ENTER_QUERY: "Enter text for search",
        LOGIN: "Log In",
        HOME: "Home",
        SEARCH: "Search",
        TITLE: "GET A JOB",
        SEEMORE: "SEE MORE...",
        LOCATION: "Location",
        COMPANY: "Company",
        OPTIONS: "Options",
        POSITION: "Position",
        PROFILE: "Profile",
        EDIT: "Edit this"
    }
}

export const ES : Dictionary = {
    LAYOUT: {
        POST_A_JOB: "Publicar Empleo",
        ENTER_QUERY: "Ingesa texto para buscar",
        LOGIN: "Ingresa al sistema",
        HOME: "Inicio",
        SEARCH: "Buscar",
        TITLE: "Consigue Empleo",
        SEEMORE: "VER MAS...",
        COMPANY: "Compañia",
        LOCATION: "Localidad",
        OPTIONS: "Opciones",
        POSITION: "Posición",
        PROFILE: "Perfil",
        EDIT: "Editar"
    }
}

const translateInstance = new MobxTranslate<Dictionary>();

translateInstance.loadStrings('EN', EN );
translateInstance.loadStrings('ES', ES );
translateInstance.setLanguage('EN');
export const trans = translateInstance;


text:
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
    <group >
        <item
            android:id="@+id/action_refresh"
            android:icon="@android:drawable/ic_menu_rotate"
            android:title="@string/refresh"
            android:showAsAction="ifRoom"
            android:orderInCategory="20" />
        <item
            android:id="@+id/action_download"
            android:icon="@android:drawable/ic_menu_save"
            android:title="@string/download"
            android:showAsAction="ifRoom"
            android:orderInCategory="21" />
        <item
            android:id="@+id/action_rename"
            android:icon="@android:drawable/ic_menu_edit"
            android:title="@string/rename"
            android:showAsAction="ifRoom"
            android:orderInCategory="22" />
        <item
            android:id="@+id/action_create_link"
            android:icon="@android:drawable/ic_menu_share"
            android:title="@string/create_link"
            android:showAsAction="ifRoom"
            android:orderInCategory="23" />
        <item
            android:id="@+id/action_set_copy_destination"
            android:icon="@android:drawable/btn_star_big_off"
            android:title="@string/set_copy_destination"
            android:enabled="true"
            android:visible="true"
            android:checkable="true"
            android:showAsAction="never"
            android:orderInCategory="24" />
        <item
            android:id="@+id/action_copy"
            android:icon="@android:drawable/ic_menu_compass"
            android:title="@string/copy_item"
            android:enabled="true"
            android:visible="true"
            android:showAsAction="never"
            android:orderInCategory="25" />
        <item
            android:id="@+id/action_navigate_by_path"
            android:icon="@android:drawable/ic_dialog_map"
            android:title="@string/navigate_by_path"
            android:enabled="true"
            android:visible="true"
            android:showAsAction="never"
            android:orderInCategory="26" />
    </group>

    <group>
        <item
            android:id="@+id/action_create_folder"
            android:title="@string/create_folder"
            android:icon="@android:drawable/ic_menu_add"
            android:showAsAction="ifRoom"
            android:orderInCategory="30" />
        <item
            android:id="@+id/action_upload_file"
            android:icon="@android:drawable/ic_menu_upload"
            android:title="@string/upload_file"
            android:showAsAction="ifRoom"
            android:orderInCategory="31" />
        <item
            android:id="@+id/action_view_delta"
            android:icon="@android:drawable/ic_menu_recent_history"
            android:title="@string/view_delta"
            android:showAsAction="ifRoom"
            android:orderInCategory="32" />
    </group>

    <group>
        <item
            android:id="@+id/action_delete"
            android:icon="@android:drawable/ic_menu_delete"
            android:title="@string/delete"
            android:showAsAction="ifRoom"
            android:orderInCategory="40" />
    </group>

</menu>


text:
<meta charset="UTF-8">
<title>System.modules - nlpengine</title>
<link rel="stylesheet" href="../../../style.css">

nlpengine / edu.umn.nlpengine / System / modules

modules

val modules: List<SystemModule>


text:
package httpresponse

import (
	"net/http"
	"octlink/rstore/utils/merrors"
	"octlink/rstore/utils/uuid"

	"github.com/gin-gonic/gin"
)

func BuildErrorObj(ctx *gin.Context, code int, errlog interface{},
	data interface{}) map[string]interface{} {

	return gin.H{
		"errorObj": gin.H{
			"errorNo":  code,
			"errorLog": errlog,
			"errorMsg": merrors.GetMsg(code),
		},
		"apiId": uuid.Generate().Simple(),
		"data":  data,
	}
}

// RHttprespnse retrun none error code 200
func Ok(ctx *gin.Context, data interface{}) {
	ctx.JSON(http.StatusOK, BuildErrorObj(ctx, merrors.ErrSuccess, nil, data))
	return
}

// RHttprespnse retrun none error code 200
func Error(ctx *gin.Context, err int, errlog interface{}) {
	ctx.JSON(http.StatusOK, BuildErrorObj(ctx, err, errlog, nil))
	return
}

// RHttprespnse retrun none error code 201
func Create(ctx *gin.Context, data interface{}) {
	ctx.JSON(http.StatusCreated, gin.H{"code": merrors.ErrSuccess, "data": nil})
	return
}

// RHttprespnse retrun none error code 204
func Delete(ctx *gin.Context, data interface{}) {
	ctx.JSON(http.StatusNoContent, gin.H{"code": merrors.ErrSuccess, "data": data})
	return
}

// RHttprespnse retrun none error code 202
func Update(ctx *gin.Context, data interface{}) {
	ctx.JSON(http.StatusAccepted, gin.H{"code": merrors.ErrSuccess, "data": data})
	return
}


text:
using System.Reflection;
using System.Runtime.InteropServices;

[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("NanoByte")]
[assembly: AssemblyProduct("NanoPlay")]
[assembly: AssemblyCopyright("Copyright © 2016 Bastian Eicher")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("0.1.0.0")]
[assembly: ComVisible(false)]


text: """The push component."""