text:
	extern "C" {
#endif

void Memcpy(void*, void*, unsigned long);
void Strcat(char*, const char*);
unsigned long IsSameString(const char*, const char*);
unsigned long Cat2Str(const char*, const char*, char*, unsigned long);

#ifdef __cplusplus
	}
#endif

#endif

redpajama_set_name: RedPajamaGithub


text:
class DateValidator
  def initialize(query)
    @query = query
  end

  def validate_to_date
    query.errors.add(:to_date, error_message) if invalid_date?(to_date)
  end

  def validate_from_date
    query.errors.add(:from_date, error_message) if invalid_date?(from_date)
  end

  def date_errors_hash
    {
      date_type => {
        from: invalid_date?(from_date),
        to: invalid_date?(to_date),
      },
    }
  end

private

  attr_reader :query

  def from_date
    query.filter_params.dig(date_type, :from)
  end

  def to_date
    query.filter_params.dig(date_type, :to)
  end

  # The date facet on search/all filters on public_timestamp, but the specialist
  # finders use a variety of different types. Error messages are
  # currently only implemented on search/all.

  def date_type
    :public_timestamp
  end

  def invalid_date?(user_input)
    user_input.present? && DateParser.new.parse(user_input).nil?
  end

  def error_message
    "Enter a real date"
  end
end


text:
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

  <title>File: History.txt</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />

History.txt

      Path:
      History.txt

      Last Update:
      Mon Aug 30 11:52:18 UTC 2010

0.9.7

JRUBY-4781: Fix multiple database connection collision issue w/ Oracle

ACTIVERECORD_JDBC-115: Support SAVEPOINTS for MySQL and PG so that nested
transactions can be faked

ACTIVERECORD_JDBC-116: Handle schema.table better for MySQL (thanks Dilshod
Mukhtarov)

Fix ‘Wrong # of arguments (2 for 1)’ issue with create_database
for MySQL and AR 3.0

SQLServer 2000 support (thanks Jay McGaffigan)

0.9.6

The Oracle release!

Oracle should be working much better with this release. Also updated to
work with Rails 3.

Get all unit tests running cleanly on Oracle, fixing previous
datetime/timezone issues.

ACTIVERECORD_JDBC-83: Add :sequence_start_value option to create_table,
following oracle_enhanced adapter

ACTIVERECORD_JDBC-33: Don‘t double-quote table names in oracle

ACTIVERECORD_JDBC-17: Fix Oracle primary keys so that /^NUMBER$/ =>
:integer

Fix remaining blockers ACTIVERECORD_JDBC-82, JRUBY-3675,
ACTIVERECORD_JDBC-22, ACTIVERECORD_JDBC-27, JRUBY-4759

0.9.5

The MSSQL release, courtesy of Mike Williams and Lonely Planet.

JRuby + AR-JDBC is now seen as the hassle-free way of using Rails with
SQLServer!

Many fixes for MSSQL, including ACTIVERECORD_JDBC-18, ACTIVERECORD_JDBC-41,
ACTIVERECORD_JDBC-56, ACTIVERECORD_JDBC-94, ACTIVERECORD_JDBC-99,
JRUBY-3805, JRUBY-3793, JRUBY-4221

All tests pass on Rails 3.0.0.beta3!

0.9.4

ACTIVERECORD_JDBC-96: DB2 JdbcSpec
cannot dump schema correctly (Youhei Kondou)

ACTIVERECORD_JDBC-97: Dont use Rails 3 deprecated constants (David
Calavera)

Updates for rake db:schema:dump compatibility with Rails 2.3+ and MySQL
(Joakim Kolsjö)

Rails 3.0.0.beta2 compatibility

Return of Derby, H2, Hsqldb support (requires AR >= 3.0.0.beta2)

0.9.3

Rails 3 compatibility

PLEASE NOTE: ActiveRecord in
Rails 3 has changed in a way that doesn‘t allow non-standard DBs
(such as the Derby and H2 embedded DBs) to work. We‘re investigating
the effort required to support these databases and hope to have something
for a future release.

ACTIVERECORD_JDBC-91: Fix schema search path for PostgreSQL (Alex Kuebo)

ACTIVERECORD_JDBC-87: DB2 ID insert fix (Youhei Kondou)

ACTIVERECORD_JDBC-90: MSSQL fix for DATEs (jlangenauer)

ACTIVERECORD_JDBC-93: Fix string IDs for sqlite3, hsql/h2 (moser)

ACTIVERECORD_JDBC-86: Fix Derby queries starting with VALUES (Dwayne
Litzenberger)

ACTIVERECORD_JDBC-95: Fix INSERT … RETURNING for PostgreSQL

0.9.2

The main, highly awaited fix for this release is a solution to the rake
db:create/db:drop issue. The main change is a new ‘jdbc’ rails
generator that should be run once to prepare a Rails application to use
JDBC. The upside of this generator is that you no longer will need to alter
database.yml for JDBC. See the README.txt for details.

Cleanup and reconnect if errors occur during begin/rollback (Jean-Dominique
Morani, Christian Seiler)

ACTIVERECORD_JDBC-1: Add drop_database method for oracle (does the same
thing as recreate_database)

Sqlite3 and MSSQL fixes (Jean-Dominique Morani)

JRUBY-3512: Treat LONGVARCHAR as a CLOB for Mssql

JRUBY-3624: Upgrade Derby to 10.5.3.0 and add native limit/offset support
(Christopher Saunders)

JRUBY-3616: Fix postgres non-sequence primary keys (David Kellum)

JRUBY-3669: Fix Oracle case with unconfigured schema (Dan Powell)

Fixed quote_column_name of jdbc_oracle to accept numbers (Marcelo Murad)

Fix for mysql tables with non standard primary keys such that the schema
dump is correct (Nick Zalabak)

MSSQL fixes from Mike Luu:

add support for MSSQL uniqueidentifier datatype

always quote strings using unicode identifier for MSSQL

Changes primary_key generation to use always instead of by default for DB2
(Amos King)

Improves the SQLite adapter by fixing rename_column, change_column,
change_column_default, changing remove_column, and adding remove_columns
(Ryan Baumann)

More oracle love courtesy Ben Browning and Jens Himmelreich

JRUBY-3608: Add missing change_column_null method for postgres

JRUBY-3508: Fix quoting of integer and float columns

0.9.1

We did a lot of internal cleanup this release in the hopes of simplifying
the code and increasing performance.

Many SQLite updates (thanks Nils Christian Haugen)

JRUBY-2912: Fix MSSQL create/drop database (Joern Hartmann)

JRUBY-2767: Mistake in selecting identity with H2/HSQLDB

JRUBY-2884: jdbc_postgre.rb issue handling nil booleans (also a fix for
hsqldb/h2) + tests

JRUBY-2995: activerecord jdbc derby adapter should quote columns called
‘year‘

JRUBY-2897: jdbc_postgre.rb needs microsecond support

JRUBY-3282: Upgrade to derby 10.4.2.0 to allow unique constraints with
nullable columns

Update h2 from 1.0.63 to 1.1.107 in driver

JRUBY-3026: [Derby] Allow select/delete/update conditions with comparison
to NULL using ’=’

JRUBY-2996: …(actually this fixes only remaining issue of this bug
which was symbols making into quote were exploding

JRUBY-2691: Update sybase driver to pass simple unit tests with jtds and
verify it works with the new dialect keyword. patch by Leigh Kennedy

Make :float type work on h2,hsql [returned as string]. Make :float work on
hsqldb (no paren value supported). Make REAL_TYPE just return RubyFloat

JRUBY-3222: Upgrade type_to_sql to variation of AR 2.1.2 version

Add patch supplied in JRUBY-3489 (patch by Jean-Dominique Morani)

Various Oracle fixes by edsono

JRUBY-2688: Don‘t hard-code MySQL connection character encoding to
utf8

0.9

Now updated to support ActiveRecord 2.2. JNDI-based
connections will automatically connect/disconnect for every AR connection
pool checkout/checkin. For best results, set your pool: parameter >= the
actual maximum size of the JNDI connection pool. (We‘ll look at how
to eliminate the need to configure AR‘s pool in the future.)

NEW! Informix support courtesy of Javier Fernandez-Ivern.

Backport another Oracle CLOB issue, thanks Edson César.

Rubyforge 22018: chomp final trailing semicolon for oracle

JRUBY-2848: Fix NPE error in set_native_database_types

Rework oracle lob saving callback to be Rails 2.1 friendly (assist from
court3nay)

JRUBY-2715: Add create/drop database methods to Postgres (Peter Williams)

JRUBY-3183: Fix structure dump for Postgres (Ryan Bell)

JRUBY-3184: recreate_database for test database working for PG (Ryan Bell)

JRUBY-3186: disable referential integrity for PG (Ryan Bell)

Authoritative repository now hosted at
git://github.com/nicksieger/activerecord-jdbc-adapter.git; rubyforge svn
trunk cleaned out.

0.8.2

Added an optional config key called :dialect. Using :dialect allows you to
override the default SQL dialect for the driver class being used. There are
a few cases for this:

Using using Sybase w/ the jTDS driver.

Using rebranded drivers.

It makes more sense to use :dialect, rather then :driver when using JNDI.

JRUBY-2619: Typo with :test config causing problems with dev database (Igor
Minar)

20524, JRUBY-2612: Since when did I think that there was a true? method on
Object?

0.8.1

Now sporting a JDBC sqlite3 adapter! Thanks Joseph Athman.

Added support for InterSystems Cache database (Ryan Bell)

Fix for JRUBY-2256

JRUBY-1638, JRUBY-2404, JRUBY-2463: schema.table handling and Oracle NUMBER
fixes (Darcy Schultz & Jesse Hu)

Add structure dump and other DDL-ish for DB2 (courtesy abedra and
stuarthalloway)

Fix missing quote_table_name function under Rails 1.2.6 and earlier

Small tweaks to jdbc.rake to select proper config

JRUBY-2011: Fix MSSQL string un-quoting issue (Silvio Fonseca)

JRUBY-1977, 17427: Fix information_schema select issue with MSSQL (Matt
Burke)

20479: Improve get_table_name for MSSQL (Aslak Hellesøy)

20243: numerics improvements for MSSQL (Aslak Hellesøy)

20172: don‘t quote table names for MSSQL (Thor Marius Henrichsen)

19729: check for primary key existence in postgres during insert (Martin
Luder)

JRUBY-2297, 18846: retrying failing SQL statements is harmful when not
autocommitting (Craig McMillan)

10021: very preliminary sybase support. (Mark Atkinson) Not usable until
collision w/ sqlserver driver is resolved.

JRUBY-2312, JRUBY-2319, JRUBY-2322: Oracle timestamping issues (Jesse Hu
& Michael König)

JRUBY-2422: Fix MySQL referential integrity and rollback issues

JRUBY-2382: mysql string quoting fails with ArrayIndexOutofBoundsException

0.8

NOTE: This release is only compatible with JRuby 1.1RC3 or later.

Because of recent API changes in trunk in preparation for JRuby 1.1, this
release is not backward compatible with previous JRuby releases. Hence the
version bump.

Internal: convert Java methods to be defined with annotations

Fix problem with reserved words coming back pre-quoted from indexes in
postgres

JRUBY-2205: Fix N^2 allocation of bytelists for mysql quoting (taw)

Attempt a fix for Rubyforge 18059

Upgrade derby to 10.3.2.1

Fix db:create etc. in the case where JDBC is loaded in Rails’
preinitializer.rb

Fix db:drop to actually work

Fix for Rubyforge 11567 (Matt Williams)

0.7.2

JRUBY-1905: add_column for derby, hsqldb, and postgresql (Stephen Bannasch)

Fix db:create for JDBC

Support Rails 2 with the old "require ‘jdbc_adapter’"
approach

JRUBY-1966: Instead of searching for just tables, search for views and
tables.

JRUBY-1583: DB2 numeric quoting (Ryan Shillington)

JRUBY-1634: Oracle DATE type mapping (Daniel Wintschel)

JRUBY-1543: rename_column issue with more recent MySQL drivers (Oliver
Schmelzle)

Rubyforge 15074: ConnectionAdapters::JdbcAdapter.indexes is missing name
and schema_name parameters in the method signature (Igor Minar)

Rubyforge 13558: definition for the indexes method (T Meyarivan)

JRUBY-2051: handle schemaname and tablename more correctly for columns

JRUBY-2102: Postgres Adapter cannot handle datetime type (Rainer Hahnekamp)

JRUBY-2018: Oracle behind ActiveRecord-JDBC fails with
"Invalid column index" (K Venkatasubramaniyan)

JRUBY-2012: jdbc_mysql structure dump fails for mysql views (Tyler
Jennings)

0.7.1

Add adapter and driver for H2 courtesy of Caleb Land

Fix "undefined method `last’ for {}:Hash" error introduced
with new Rake 0.8.1 (JRUBY-1859)

0.7

PLEASE NOTE: This release is not compatible with JRuby releases earlier
than 1.0.3 or 1.1b2. If you must use JRuby 1.0.2 or earlier, please install
the 0.6 release.

Release coincides with JRuby 1.0.3 and JRuby 1.1b2 releases

Simultaneous support for JRuby trunk and 1.0 branch

Get rid of log_no_bench method, so we time SQL execution again.

Implement select_rows

MySQL migration and quoting updates

0.6

Gem is renamed to "activerecord-jdbc-adapter" to follow new
conventions introduced in Rails 2.0 for third-party adapters. Rails 2.0
compatibility is introduced.

Add dependency on ActiveRecord
>= 1.14 (from the Rails 1.1.x release)

New drivers (jdbc-XXX) and adapter (activerecord-jdbcXXX-adapter) gems
available separately. See the README.txt file for details.

Plain "jdbc" driver is still available if you want to use the
full driver/url way of specifying the driver.

More bugfixes to Oracle and SQLServer courtesy of Ola & ThoughtWorks

0.5

Release coincides with JRuby 1.0.1 release

It is no longer necessary to specify :driver and :url configuration
parameters for the mysql, postgresql, oracle, derby, hsqldb, and h2
adapters. The previous configuration is still valid and compatible, but for
new applications, this makes it possible to use the exact same database.yml
configuration as Rails applications running under native Ruby.

JDBC drivers can now be dynamically loaded by Ruby code, without being on
the classpath prior to launching JRuby. Simply use "require
‘jdbc-driver.jar’" in JRuby code to add it to the runtime
classpath.

Updates to HSQL, MS SQLServer, Postgres, Oracle and Derby adapters

0.4

Release coincides with JRuby 1.0 release

Shoring up PostgreSQL (courtesy Dudley Flanders) and HSQL (courtesy Matthew
Williams)

Fix timestamps on Oracle to use DATE (as everything else)

Derby fixes: Fix for open result set issue, better structure dump, quoting,
column type changing

Sybase type recognition fix (courtesy Dean Mao)

0.3.1

Derby critical fixes shortly after 0.3

0.3

Release coincides with JRuby 1.0.0RC1 release

Improvements for Derby, Postgres, and Oracle, all of which are running >
95% of AR tests

0.2.4

Release coincides with JRuby 0.9.9 release

JRuby 0.9.9 is required

MySQL close to 100% working

Derby improvements

DECIMAL/NUMERIC/FLOAT/REAL bugs fixed with type recognition for Oracle,
Postgres, etc.

HSQLDB has regressed this release and may not be functioning; we‘ll
get it fixed for the next one

0.2.3

Release coincides (and compatible) with JRuby 0.9.8 release

8 bugs fixed: see rubyurl.com/0Da

Improvements and compatibility fixes for Rails 1.2.x

0.2.1, 0.2.2

Early releases, added better support for multiple databases

0.0.1

Initial, very alpha release

[Validate]


text:
package com.websystique.springsecurity.configuration;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;

@Configuration
@EnableWebSecurity
public class SecurityConfiguration extends WebSecurityConfigurerAdapter {

	@Autowired
	@Qualifier("userDetailsService")
	UserDetailsService userDetailsService;

	@Autowired
	public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
		auth.userDetailsService(userDetailsService);
	}

/*	@Autowired
	public void configureGlobalSecurity(AuthenticationManagerBuilder auth) throws Exception {
		auth.inMemoryAuthentication().withUser("bill").password("abc123").roles("USER");
		auth.inMemoryAuthentication().withUser("admin").password("root123").roles("ADMIN");
		auth.inMemoryAuthentication().withUser("dba").password("root123").roles("ADMIN","DBA");
	}*/

	@Override
	protected void configure(HttpSecurity http) throws Exception {

	  http.authorizeRequests()
	  	//.antMatchers("/", "/home").permitAll()
	  	.antMatchers("/").access("hasRole('ROLE_ADMIN')")
	  	//.antMatchers("/db/**").access("hasRole('ADMIN') and hasRole('DBA')")
	  	.and().formLogin().loginPage("/login")
	  	.usernameParameter("username").passwordParameter("password")
	  	.and().exceptionHandling().accessDeniedPage("/Access_Denied");
	}

	@Bean
	public PasswordEncoder passwordEncoder(){
		PasswordEncoder encoder = new BCryptPasswordEncoder();
		return encoder;
	}

}


text:
  #define PYUL_DEFINED
  #ifdef __EA64__
    typedef unsigned PY_LONG_LONG pyul_t;
    typedef PY_LONG_LONG pyl_t;
  #else
    typedef unsigned long pyul_t;
    typedef long pyl_t;
  #endif
#endif

// "A pointer can be explicitly converted to any integral type large
//  enough to hold it. The mapping function is implementation-defined."
//                                                           — C++03
// => G++ (and probably MSVC) will typically first sign-extend the pointer.
//
// int bar(void *p) { return foo(uint64(p)); }
//
// translates to:
//
// mov    0x8(%ebp),%eax
// mov    %eax,%edx
// sar    $0x1f,%edx     ; <---- boom!
// mov    %eax,(%esp)
// mov    %edx,0x4(%esp)
// call   2d <_Z3barPv+0x16>

#ifdef __X64__
#define PTR2U64(Binding) (uint64(Binding))
#else
#define PTR2U64(Binding) (uint64(uint32(Binding)))
#endif

#ifdef __EA64__
  #define PY_FMT64  "K"
  #define PY_SFMT64 "L"
#else
  #define PY_FMT64  "k"
  #define PY_SFMT64 "l"
#endif

//------------------------------------------------------------------------
#define S_IDAAPI_MODNAME                         "idaapi"
#define S_IDC_MODNAME                            "idc"
#define S_IDAAPI_EXECSCRIPT                      "IDAPython_ExecScript"
#define S_IDAAPI_COMPLETION                      "IDAPython_Completion"
#define S_IDAAPI_FORMATEXC                       "IDAPython_FormatExc"
#define S_IDAAPI_LOADPROCMOD                     "IDAPython_LoadProcMod"
#define S_IDAAPI_UNLOADPROCMOD                   "IDAPython_UnLoadProcMod"

//------------------------------------------------------------------------
// PyIdc conversion object IDs
#define PY_ICID_INT64                            0
#define PY_ICID_BYREF                            1
#define PY_ICID_OPAQUE                           2

//------------------------------------------------------------------------
// Constants used with the notify_when()
#define NW_OPENIDB          0x0001
#define NW_OPENIDB_SLOT     0
#define NW_CLOSEIDB         0x0002
#define NW_CLOSEIDB_SLOT    1
#define NW_INITIDA          0x0004
#define NW_INITIDA_SLOT     2
#define NW_TERMIDA          0x0008
#define NW_TERMIDA_SLOT     3
#define NW_REMOVE           0x0010 // Uninstall flag
#define NW_EVENTSCNT        4 // Count of notify_when codes

//------------------------------------------------------------------------
// Constants used by the pyvar_to_idcvar and idcvar_to_pyvar functions
#define CIP_FAILED      -1 // Conversion error
#define CIP_IMMUTABLE    0 // Immutable object passed. Will not update the object but no error occured
#define CIP_OK           1 // Success
#define CIP_OK_OPAQUE    2 // Success, but the data pointed to by the PyObject* is an opaque object.

//---------------------------------------------------------------------------
class gil_lock_t
{
private:
  PyGILState_STATE state;
public:
  gil_lock_t()
  {
    state = PyGILState_Ensure();
  }

  ~gil_lock_t()
  {
    PyGILState_Release(state);
  }
};
// Declare a variable to acquire/release the GIL
#define PYW_GIL_GET gil_lock_t lock;

#define GIL_CHKCONDFAIL (((debug & IDA_DEBUG_PLUGIN) == IDA_DEBUG_PLUGIN) \
                      && PyGILState_GetThisThreadState() != _PyThreadState_Current)

#define PYW_GIL_CHECK_LOCKED_SCOPE()                                    \
  do                                                                    \
  {                                                                     \
    if ( GIL_CHKCONDFAIL )                                              \
    {                                                                   \
      msg("*** WARNING: Code at %s:%d should have the GIL, but apparently doesn't ***\n", \
          __FILE__, __LINE__);                                          \
      if ( under_debugger )                                             \
        BPT;                                                            \
    }                                                                   \
  } while ( false )

//-------------------------------------------------------------------------
struct exc_report_t
{
  ~exc_report_t()
  {
    if ( PyErr_Occurred() )
      PyErr_Print();
  }
};
#define PYW_GIL_GET_AND_REPORT_ERROR PYW_GIL_GET; exc_report_t exc;

//------------------------------------------------------------------------
// All the exported functions from PyWraps are forward declared here
insn_t *insn_t_get_clink(PyObject *self);
op_t *op_t_get_clink(PyObject *self);

//-------------------------------------------------------------------------
// The base for a reference. Will automatically increase the reference
// counter for the object when it is assigned from another ref_t,
// and decrease the reference counter when destroyed.
// This is meant to be used whenever possible, in order to prevent
// situations where, e.g., a given code path is taken and we return from
// a function without first decreasing the reference counter.
//
// Note: You should never, ever have to Py_[INCREF|DECREF] the 'o' object yourself.
// Note: These simple ref_t cannot be created with a PyObject* directly
//       (that would be the role of 'newref_t'/'borref_t' below.)
//       In other words: simple 'ref_t' instances are never created from the
//       result of calling the CPython API. They are only used when in
//       idapython land.
//       In yet other words: the CPython API only deals in terms of
//       'New references' and 'Borrowed references'. Those are implemented,
//       respectively, by the 'newref_t' and 'borref_t' classes below.
//       This 'ref_t' is only used for internal handling.
struct ref_t
{
  PyObject *o;

  ref_t() : o(NULL) {}
  ref_t(const ref_t &other) : o(other.o) { incref(); }
  ~ref_t() { decref(); }
  ref_t &operator=(const ref_t &other)
  {
    // We *must* first (possibly) set & incref the other object,
    // because decref() might call the Python's deallocator, which
    // might have side-effects, that might affect this ref_t
    // instance.
    // If that's too many 'might' to your taste, let me illustrate.
    //
    // py_plgform.hpp's 'plgform_t' holds a 'ref_t' instance, named 'py_obj'.
    // If the actual, Qt widget wrapped by that plgform_t gets destroyed,
    // plgform_t::unhook() will be called, which will assign an
    // empty ref_t instance to its 'py_obj'.
    // That will decrement the refcount, and might call the deallocator:
    // the plgform_t::destroy static function.
    // That function will 'delete' the plgform_t object.
    // But, in the ~plgform_t() destructor, the 'py_obj' object will be
    // destroyed too: decreasing once again the refcnt (which now falls to -1).
    // At this point, all hell breaks loose (or is allowed to).
    PyObject *was = o;
    o = other.o;
    incref();
    if ( was != NULL )
      Py_DECREF(was);
    return *this;
  }

  void incref() const { if ( o != NULL ) Py_INCREF(o); }
  void decref() const { if ( o != NULL ) { QASSERT(30469, o->ob_refcnt > 0); Py_DECREF(o); } }

  bool operator==(PyObject *other) const { return o == other; }
  bool operator!=(PyObject *other) const { return !((*this) == other); }

  bool operator==(const ref_t &other) const { return o == other.o; }
  bool operator!=(const ref_t &other) const { return !((*this) == other); }
};

//-------------------------------------------------------------------------
// A 'new' reference. Typically used when the CPython implementation returns
// a PyObject* whose refcnt was already increased, and that the caller is
// responsible for releasing.
//
// This implements the 'New reference' idea at http://docs.python.org/2/c-api/intro.html:
// ---
// "When a function passes ownership of a reference on to its caller,
//  the caller is said to receive a new reference"
// ---
// E.g., from "PyObject_GetAttrString"'s doc:
// ---
// "Return value: New reference.
//  Retrieve an attribute named attr_name from object o[...]"
// ---
struct newref_t : public ref_t
{
  newref_t(); // No.
  newref_t(const newref_t &other); // No.
  newref_t &operator=(const newref_t &other); // No.
  newref_t(PyObject *_o)
  {
#ifdef _DEBUG
    QASSERT(30409, _o == NULL || _o->ob_refcnt >= 1);
#endif
    o = _o;
  }
};

//-------------------------------------------------------------------------
// A 'borrowed' reference. Typically used when the CPython implementation returns
// a PyObject* whose ownership is _not_ transferred to the caller.
// Therefore, and since the caller wants to make sure the object is not
// released while it is using it, it must first increase the reference count,
// and then decrease it.
//
// This is similar to the simpler 'ref_t' in that it first increases, and then
// decreases the reference count. The difference is that 'borref_t' instances
// can be created with a PyObject*, while 'ref_t' instances cannot (by design).
//
// This implements the 'Borrowed reference' idea at http://docs.python.org/2/c-api/intro.html:
// ---
// "When no ownership is transferred, the caller is said to borrow the reference.
//  Nothing needs to be done for a borrowed reference."
// ---
struct borref_t : public ref_t
{
  borref_t(); // No.
  borref_t(const newref_t &other); // No.
  borref_t &operator=(const newref_t &other); // No.
  borref_t(PyObject *_o)
  {
    o = _o;
    incref(); // ~ref_t() will decref(), so we need to incref.
  }
};

//------------------------------------------------------------------------
// Vector of ref_t
struct ref_vec_t : public qvector<ref_t>
{
  void to_pyobject_pointers(qvector<PyObject*> *out)
  {
    size_t n = size();
    out->resize(n);
    for ( size_t i = 0; i < n; ++i )
      out->at(i) = at(i).o;
  }
};

// Returns a new reference to a class
// Return value: New reference.
ref_t get_idaapi_attr(const char *attr);

// Returns a new reference to a class by its ID
// Return value: New reference.
ref_t get_idaapi_attr_by_id(const int class_id);

// Tries to import a module and swallows the exception if it fails and returns NULL
// Return value: New reference.
ref_t PyW_TryImportModule(const char *name);

// Tries to get an attribute and swallows the exception if it fails and returns NULL
ref_t PyW_TryGetAttrString(PyObject *py_var, const char *attr);

// Returns the linked object (void *) from a PyObject
void *pyobj_get_clink(PyObject *pyobj);

// Converts a Python number (LONGLONG or normal integer) to an IDC variable (VT_LONG or VT_INT64)
bool PyW_GetNumberAsIDC(PyObject *py_var, idc_value_t *idc_var);

// Returns a qstring from a Python attribute string
bool PyW_GetStringAttr(
    PyObject *py_obj,
    const char *attr_name,
    qstring *str);

// Converts a Python number to an uint64 and indicates whether the number was a long number
bool PyW_GetNumber(PyObject *py_var, uint64 *num, bool *is_64 = NULL);

// Checks if an Python object can be treated like a sequence
bool PyW_IsSequenceType(PyObject *obj);

// Returns an error string from the last exception (and clears it)
bool PyW_GetError(qstring *out = NULL, bool clear_err = true);
bool PyW_GetError(char *buf, size_t bufsz, bool clear_err = true);

// If an error occured (it calls PyGetError) it displays it and return TRUE
// This function is used when calling callbacks
bool PyW_ShowCbErr(const char *cb_name);

// Utility function to create linked class instances
ref_t create_idaapi_linked_class_instance(const char *clsname, void *lnk);

// Returns the string representation of a PyObject
bool PyW_ObjectToString(PyObject *obj, qstring *out);

// Utility function to convert a python object to an IDC object
// and sets a python exception on failure.
bool pyvar_to_idcvar_or_error(const ref_t &py_obj, idc_value_t *idc_obj);

// Creates and initializes an IDC exception
error_t PyW_CreateIdcException(idc_value_t *res, const char *msg);

//
// Conversion functions
//
bool pyw_convert_idc_args(
        const idc_value_t args[],
        int nargs,
        ref_vec_t &pargs,
        bool as_tupple,
        char *errbuf = NULL,
        size_t errbufsize = 0);

// Converts Python variable to IDC variable
// gvar_sn is used in case the Python object was a created from a call to idcvar_to_pyvar and the IDC object was a VT_REF
int pyvar_to_idcvar(
        const ref_t &py_var,
        idc_value_t *idc_var,
        int *gvar_sn = NULL);

// Converts from IDC to Python
// We support converting VT_REF IDC variable types
int idcvar_to_pyvar(
  const idc_value_t &idc_var,
  ref_t *py_var);

// Walks a Python list or Sequence and calls the callback
Py_ssize_t pyvar_walk_list(
        const ref_t &py_list,
        int (idaapi *cb)(const ref_t &py_item, Py_ssize_t index, void *ud) = NULL,
        void *ud = NULL);
Py_ssize_t pyvar_walk_list(
        PyObject *py_list,
        int (idaapi *cb)(const ref_t &py_item, Py_ssize_t index, void *ud) = NULL,
        void *ud = NULL);

// Converts an intvec_t to a Python list object
ref_t PyW_IntVecToPyList(const intvec_t &intvec);

// Converts an Python list to an intvec
bool PyW_PyListToIntVec(PyObject *py_list, intvec_t &intvec);

// Converts a Python list to a qstrvec
bool PyW_PyListToStrVec(PyObject *py_list, qstrvec_t &strvec);

//-------------------------------------------------------------------------
PyObject *qstrvec2pylist(qstrvec_t &vec);

//-------------------------------------------------------------------------
inline bool PyWStringOrNone_Check(PyObject *tp)
{
  return tp == Py_None || PyString_Check(tp);
}

//-------------------------------------------------------------------------
inline const p_list * PyW_Fields(PyObject *tp)
{
  return tp == Py_None ? NULL : (const p_list *) PyString_AsString(tp);
}

//---------------------------------------------------------------------------
//
// notify_when()
//
bool pywraps_nw_term();
bool pywraps_nw_notify(int slot, ...);
bool pywraps_nw_init();

//---------------------------------------------------------------------------
bool pywraps_check_autoscripts(char *buf, size_t bufsize);

// [De]Initializes PyWraps
bool init_pywraps();
void deinit_pywraps();

void hexrays_clear_python_cfuncptr_t_references(void);

void free_compiled_form_instances(void);

//#define PYGDBG_ENABLED
#ifdef PYGDBG_ENABLED
#define PYGLOG(...) msg(__VA_ARGS__)
#else
#define PYGLOG(...)
#endif

//-------------------------------------------------------------------------
struct pycall_res_t
{
  pycall_res_t(PyObject *pyo);
  ~pycall_res_t();

  inline bool success() const { return result.o != NULL; }

  newref_t result;

private:
  pycall_res_t(); // No.
};

#endif


text:
require 'google/protobuf'

require 'google/protobuf/duration_pb'
require 'google/api/annotations_pb'
Google::Protobuf::DescriptorPool.generated_pool.build do
  add_message "google.cloud.dialogflow.v2.InputAudioConfig" do
    optional :audio_encoding, :enum, 1, "google.cloud.dialogflow.v2.AudioEncoding"
    optional :sample_rate_hertz, :int32, 2
    optional :language_code, :string, 3
    repeated :phrase_hints, :string, 4
    optional :model_variant, :enum, 10, "google.cloud.dialogflow.v2.SpeechModelVariant"
    optional :single_utterance, :bool, 8
  end
  add_message "google.cloud.dialogflow.v2.VoiceSelectionParams" do
    optional :name, :string, 1
    optional :ssml_gender, :enum, 2, "google.cloud.dialogflow.v2.SsmlVoiceGender"
  end
  add_message "google.cloud.dialogflow.v2.SynthesizeSpeechConfig" do
    optional :speaking_rate, :double, 1
    optional :pitch, :double, 2
    optional :volume_gain_db, :double, 3
    repeated :effects_profile_id, :string, 5
    optional :voice, :message, 4, "google.cloud.dialogflow.v2.VoiceSelectionParams"
  end
  add_message "google.cloud.dialogflow.v2.OutputAudioConfig" do
    optional :audio_encoding, :enum, 1, "google.cloud.dialogflow.v2.OutputAudioEncoding"
    optional :sample_rate_hertz, :int32, 2
    optional :synthesize_speech_config, :message, 3, "google.cloud.dialogflow.v2.SynthesizeSpeechConfig"
  end
  add_enum "google.cloud.dialogflow.v2.AudioEncoding" do
    value :AUDIO_ENCODING_UNSPECIFIED, 0
    value :AUDIO_ENCODING_LINEAR_16, 1
    value :AUDIO_ENCODING_FLAC, 2
    value :AUDIO_ENCODING_MULAW, 3
    value :AUDIO_ENCODING_AMR, 4
    value :AUDIO_ENCODING_AMR_WB, 5
    value :AUDIO_ENCODING_OGG_OPUS, 6
    value :AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE, 7
  end
  add_enum "google.cloud.dialogflow.v2.SpeechModelVariant" do
    value :SPEECH_MODEL_VARIANT_UNSPECIFIED, 0
    value :USE_BEST_AVAILABLE, 1
    value :USE_STANDARD, 2
    value :USE_ENHANCED, 3
  end
  add_enum "google.cloud.dialogflow.v2.SsmlVoiceGender" do
    value :SSML_VOICE_GENDER_UNSPECIFIED, 0
    value :SSML_VOICE_GENDER_MALE, 1
    value :SSML_VOICE_GENDER_FEMALE, 2
    value :SSML_VOICE_GENDER_NEUTRAL, 3
  end
  add_enum "google.cloud.dialogflow.v2.OutputAudioEncoding" do
    value :OUTPUT_AUDIO_ENCODING_UNSPECIFIED, 0
    value :OUTPUT_AUDIO_ENCODING_LINEAR_16, 1
    value :OUTPUT_AUDIO_ENCODING_MP3, 2
    value :OUTPUT_AUDIO_ENCODING_OGG_OPUS, 3
  end
end

module Google
  module Cloud
    module Dialogflow
      module V2
        InputAudioConfig = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.InputAudioConfig").msgclass
        VoiceSelectionParams = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.VoiceSelectionParams").msgclass
        SynthesizeSpeechConfig = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.SynthesizeSpeechConfig").msgclass
        OutputAudioConfig = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.OutputAudioConfig").msgclass
        AudioEncoding = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.AudioEncoding").enummodule
        SpeechModelVariant = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.SpeechModelVariant").enummodule
        SsmlVoiceGender = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.SsmlVoiceGender").enummodule
        OutputAudioEncoding = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.dialogflow.v2.OutputAudioEncoding").enummodule
      end
    end
  end
end


text:
param(
   [Parameter(Mandatory=$true, Position=0)][string]$ProjectName,
   [Parameter(Mandatory=$true)][Version]$AssemblyVersion,
   [Parameter(Mandatory=$true)][Version]$PackageVersion,
   [Parameter()][string]$PreRelease
)

$ErrorActionPreference = "Stop"
Push-Location (Split-Path $script:MyInvocation.MyCommand.Path)

$solutionPath = Resolve-Path ..\..
$configuration = "Release"

function ProjectPath([string]$projName) {
   Resolve-Path $solutionPath\src\$projName
}

function ProjectFile([string]$projName) {
   $projPath = ProjectPath $projName
   return "$projPath\$projName.csproj"
}

function BuildProj([string]$projName, [string]$projFile, [string]$target) {

   $pack = $target -eq "Pack"

   if ($pack) {

      $projDoc = New-Object Xml.XmlDocument
      $projDoc.PreserveWhitespace = $true
      $projDoc.Load($projFile)

      $itemXml = "<ItemGroup xmlns='$($projDoc.DocumentElement.NamespaceURI)'>
         <None Include='$solutionPath\LICENSE.txt' Pack='true' PackagePath=''/>
         <None Include='$solutionPath\NOTICE.xml' Pack='true' PackagePath=''/>
         <None Include='$(Resolve-Path icon.png)' Pack='true' PackagePath=''/>
      </ItemGroup>"

      $itemReader = [Xml.XmlReader]::Create((New-Object IO.StringReader $itemXml))
      $itemReader.MoveToContent() | Out-Null
      $itemNode = $projDoc.ReadNode($itemReader)
      $projDoc.DocumentElement.AppendChild($itemNode) | Out-Null
      $itemNode.RemoveAttribute("xmlns")

      $projDoc.Save($projFile)
   }

   MSBuild $projFile /t:$target /v:minimal `
      /p:NoBuild=$pack `
      /p:Configuration=$configuration `
      /p:PackageOutputPath=$outputPath `
      /p:GenerateDocumentationFile=$(-not $pack) `
      /p:Product=$($notice.work) `
      /p:AssemblyVersion=$AssemblyVersion `
      /p:FileVersion=$PackageVersion `
      /p:VersionPrefix=$PackageVersion `
      /p:VersionSuffix=$PreRelease `
      /p:Authors=$($notice.authors) `
      /p:PackageLicenseExpression=$($notice.license.name) `
      /p:PackageProjectUrl=$($notice.website) `
      /p:Copyright=$($notice.copyright) `
      /p:Company=$($notice.website) `
      /p:PackageIcon=icon.png `
      /p:PackageReleaseNotes="For a list of changes see $($notice.website)docs/changes.html"

   if ($pack) {
      $projDoc.DocumentElement.RemoveChild($itemNode) | Out-Null
      $projDoc.Save($projFile)
   }
}

function NuPack([string]$projName) {

   $pkgVersion = "$PackageVersion$(if ($PreRelease) { ""-$PreRelease"" } else { $null })"
   $projPath = Resolve-Path $solutionPath\src\$projName
   $projFile = "$projPath\$projName.csproj"

   [xml]$noticeDoc = Get-Content $solutionPath\NOTICE.xml
   $notice = $noticeDoc.DocumentElement

   if (-not (Test-Path nupkg -PathType Container)) {
      md nupkg | Out-Null
   }

   $outputPath = Resolve-Path nupkg

   # build project
   BuildProj $projName $projFile "Build"

   # build API docs (transforms assembly XML doc)
   ..\docs\build-docs.ps1 -NoBuildProj -XmlOnly

   # pack
   BuildProj $projName $projFile "Pack"
}

try {

   $nuget = ..\ensure-nuget.ps1
   ..\restore-packages.ps1

   if ($ProjectName -eq '*') {
      NuPack DbExtensions
   } else {
      NuPack $ProjectName
   }

} finally {
   Pop-Location
}


text:
@interface CardSectionImpl : NSObject<CardSection, CellDelegate>
-(instancetype)init;
@end


text:
package com.silverforge.elasticsearchrawclient.queryDSL.functions;

import com.silverforge.elasticsearchrawclient.model.QueryTypeItem;
import com.silverforge.elasticsearchrawclient.queryDSL.Constants;
import com.silverforge.elasticsearchrawclient.queryDSL.operators.MultiValueModeOperator;
import com.silverforge.elasticsearchrawclient.utils.QueryTypeArrayList;

abstract class DecayFunction {
    public static abstract class Init<T extends Init<T>> {
        protected final QueryTypeArrayList<QueryTypeItem> queryBag = new QueryTypeArrayList<>();

        protected abstract T self();

        public T fieldName(String fieldName) {
            queryBag.addParentItem(Constants.FIELD_NAME, fieldName);
            return self();
        }

        public T origin(String origin) {
            queryBag.addItem(Constants.ORIGIN, origin);
            return self();
        }

        public T scale(String scale) {
            queryBag.addItem(Constants.SCALE, scale);
            return self();
        }

        public T offset(String offset) {
            queryBag.addItem(Constants.OFFSET, offset);
            return self();
        }

        public T decay(float decay) {
            queryBag.addItem(Constants.DECAY, decay);
            return self();
        }

        public T multiValueMode(MultiValueModeOperator multiValueModeOperator) {
            String value = multiValueModeOperator.toString();
            queryBag.addItem(Constants.MULTI_VALUE_MODE, value);
            return self();
        }
    }
}


text:
ALTER TABLE SeriesSeason DROP

	CONSTRAINT FK_SeriesSeason_SeriesID


text:
<?php

namespace Zenify\TitleComponent\Tests\Source;

use Nette\Localization\ITranslator;

class DummyTranslator implements ITranslator
{

	/**
	 * @var array
	 */
	private $translations = [
		'homepage.title.english' => 'Welcome home',
		'user.detail.name' => 'This is profile of %name%',
	];

	/**
	 * Translator in Kdyby\Translation style
	 * @see https://github.com/Kdyby/Translation/blob/master/src/Kdyby/Translation/Translator.php
	 *
	 * @param string $message
	 * @param int $count
	 * @param array $parameters
	 * @return string
	 */
	public function translate($message, $count = NULL, array $parameters = [])
	{
		if ( ! isset($this->translations[$message])) {
			return $message;
		}

		$message = $this->translations[$message];
		if ($parameters) {
			$tmp = [];
			foreach ($parameters as $key => $val) {
				$tmp['%' . trim($key, '%') . '%'] = $val;
			}
			$parameters = $tmp;
			return strtr($message, $parameters);
		}

		return $message;
	}

}


text:
Objenesis is a library dedicated to bypass the constructor when creating an object. On any JVM there is.

You can find the website and user documentation at [objenesis.org](http://objenesis.org).

# Developer information

## Project status

[![Build Status](https://github.com/easymock/objenesis/actions/workflows/ci.yml/badge.svg)](https://github.com/easymock/objenesis/actions/workflows/ci.yml?query=branch%3Amaster)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/org.objenesis/objenesis/badge.svg)](https://maven-badges.herokuapp.com/maven-central/org.objenesis/objenesis)

## Environment setup

I'm using:
- Maven 3.8.5
- IntelliJ Ultimate 2022.1.2 (thanks to JetBrains for the license) (it should also work with Eclipse)

To configure your local workspace:
- Import the Maven parent project to Eclipse or IntelliJ
- Import the Eclipse formatting file `objenesis-formatting.xml` (usable in Eclipse or IntelliJ)

## To build with Maven

There are two different levels of build.

### Build without any active profile

It is a basic compilation of the application.

`mvn install`

### Full build

This build will create the source and javadoc jars and run spotbugs.

`mvn install -Pfull`

## To run special builds

### Run the Android TCK

####Install required tools:
##### MacOs / *nix
- Install the Android SDK (`brew cask install android-sdk`)
- Install `platform-tools` and `build-tools` using the sdkmanager (`sdkmanager "platform-tools" "build-tools"`)
- Add an `ANDROID_HOME` to target the Android SDK (`export ANDROID_HOME=$(realpath $(echo "$(dirname $(readlink $(which sdkmanager)))/../.."))`)
#### Windows
- [Install Android Studio](https://developer.android.com/studio)
- Launch studio and install SDK and emulator
- Add an `ANDROID_HOME` to environmental variables (path used to install SDK on previous step)

####Run
- Configure a device (real or simulated) and launch it (use **API 26**, after that it asks for a signature, that isn't supported yet)
- Activate the debug mode if it's a real device
- `mvn package -Pandroid`

### Run the benchmarks

```bash
mvn package -Pbenchmark
cd benchmark
./launch.sh
```

### Generate the website

`mvn package -Pwebsite`

## To update the versions

- `mvn versions:set -DnewVersion=X.Y -Pall`
- `mvn versions:commit -Pall` if everything is ok, `mvn versions:revert -Pall` otherwise

## Configure to deploy to the Sonatype maven repository

- You will first need to add something like this to your settings.xml
```xml
<servers>
   <server>
      <id>ossrh</id>
      <username>sonatypeuser</username>
      <password>sonatypepassword</password>
   </server>
</servers>
```
- Then follow the [instructions](https://central.sonatype.org/pages/working-with-pgp-signatures.html) from the site below to create your key to sign the deployed items

## To check dependencies and plugins versions

`mvn versions:display-dependency-updates versions:display-plugin-updates -Pall`

## To upgrade the Maven wrapper

`mvn wrapper:wrapper`

## To update the license

`mvn validate license:format -Pall`

## To run modernizer

`mvn modernizer:modernizer -Pall`

## To release

* Add the release notes in `website/site/content/notes.html` You use this code to generate it

```bash
# Get the milestone matching the version
version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout | cut -d'-' -f1)
milestone=$(curl -s "https://api.github.com/repos/easymock/objenesis/milestones" | jq ".[] | select(.title==\"$version\") | .number")
echo "<h1>Version $version ($(date '+%Y-%m-%d'))</h1>"
echo
echo "<ul>"
curl -s "https://api.github.com/repos/easymock/objenesis/issues?milestone=${milestone}&state=all" | jq -r '.[] | "  <li>" + .title + " (#" + (.number|tostring) + ")</li>"'
echo "</ul>"
```

* Launch an Android device (virtual or physical)
* Launch `./deploy.sh`
* Answer the questions (normally, just acknowledge the proposed default)
* Follow the instructions

If something fails, and you need to rollback a bit, the following commands might help:
```bash
mvn release:rollback -Pall
git tag -d $version
git push origin :refs/tags/$version
git reset --hard HEAD~2
```

If you find something went wrong you can drop the staging repository with `mvn nexus-staging:drop`.

## Deploy the website

* Make sure the pom is at the version you want to release
* Launch `./deploy-website.sh`


text:
package org.carewebframework.vista.plugin.allergies;

import static org.carewebframework.common.StrUtil.U;
import static org.carewebframework.common.StrUtil.piece;
import static org.carewebframework.common.StrUtil.split;

import java.util.List;

import org.carewebframework.ui.zk.ZKUtil;
import org.carewebframework.vista.ui.common.CoverSheetBase;

import org.zkoss.zul.Listitem;
import org.zkoss.zul.Menuitem;

/**
 * Controller for patient allergies cover sheet.
 */
public class MainController extends CoverSheetBase<String> {

    private static final long serialVersionUID = 1L;

    private Menuitem mnuDeleteADR;

    private Menuitem mnuEditADR;

    private Menuitem mnuNewADR;

    private Menuitem mnuSignADR;

    private String statusADR;

    @Override
    protected void init() {
        setup("Adverse Reactions", "Adverse Reaction Detail", "RGCWARCV LIST", "RGCWARCV DETAIL", 1, "Agent", "Reaction",
            "Status");
        // TODO: Allergy service access
        super.init();
    }

    @Override
    protected void render(String dao, List<Object> columns) {
        String[] pcs = split(dao, U, 6);

        if (pcs[0].isEmpty()) {
            statusADR = pcs[1];
            return;
        }
        String stat = pcs[5];
        boolean canSign = "1".equals(pcs[4]);

        if ("U".equals(stat) && !canSign) {
            return;
        }

        columns.add(pcs[1]);
        columns.add(pcs[3]);
        columns.add((canSign ? "*" : "") + formatStatus(stat));
    }

    private String formatStatus(String stat) {
        return "U".equals(stat) ? "Unsigned" : "S".equals(stat) ? "Nonverified" : "V".equals(stat) ? "Verified" : "Unknown";
    }

    @Override
    protected void renderItem(Listitem item, String dao) {
        super.renderItem(item, dao);

        if ("1".equals(piece(dao, U, 5))) {
            ZKUtil.updateStyle(item, "font-color", "blue");
        }
    }

    public void onClick$mnuDeleteADR() {

    }

    public void onClick$mnuEditADR() {

    }

    public void onClick$mnuNewADR() {

    }

    public void onClick$mnuSignADR() {

    }

}


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>org.kie</groupId>
    <artifactId>kie-api-parent</artifactId>
    <version>6.1.0-SNAPSHOT</version>
  </parent>

  <artifactId>droolsjbpm-introduction-docs</artifactId>
  <packaging>jdocbook</packaging>

  <name>Drools and jBPM introduction documentation</name>
  <description>Introduction documentation for Drools, jBPM and Guvnor.</description>

</project>


text:
package com.mikero.pdfcompare;

import java.awt.Rectangle;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Iterator;

import javax.imageio.ImageIO;
import javax.imageio.ImageReadParam;
import javax.imageio.ImageReader;
import javax.imageio.stream.ImageInputStream;

public class CropImageImpl implements CropImage {

	@Override
	public void CropImageFromPath(String filePath)
	{
	    FileInputStream is = null;
	    ImageInputStream iis = null;
	    int imageHeight = ImageUtil.getImageHeight(filePath);
	    int count = imageHeight/100;

	    int dif = imageHeight%100;
	    try
		{
            is = new FileInputStream(filePath);

            System.out.println("file path is " + filePath);
            Iterator<ImageReader> it = ImageIO.getImageReadersByFormatName(ConstantsIF.PDF_CONVERT_IMAGE_TYPE);
            ImageReader reader = it.next();
            iis = ImageIO.createImageInputStream(is);

            reader.setInput(iis, true);
            for(int i = 0;i<count-2;i++)
            {
	            ImageReadParam param = reader.getDefaultReadParam();
	            //here need to adjust
	            //Rectangle rect = new Rectangle(0, 0, 800, 520);
	            Rectangle rect = new Rectangle(0,i*100, 800, 100);

	//            param.setSourceRegion(rect);
	//
	//            BufferedImage bi = reader.read(0, param);

	            param.setSourceRegion(rect);

	            BufferedImage bi = reader.read(0, param);

	            if(filePath.contains("test1"))
	            {
	            	ImageIO.write(bi, "png", new File(filePath.replace("test1.png", ConstantsIF.CROP_TEST_PDF_IMAGE_NAME  + i + ConstantsIF.EXTENSIONDOT + ConstantsIF.PDF_CONVERT_IMAGE_TYPE)));
	            }
	            else
	            {
	                ImageIO.write(bi, "png", new File(filePath.replace("base1.png", ConstantsIF.CROP_BASE_PDF_IMAGE_NAME  + i +  ConstantsIF.EXTENSIONDOT + ConstantsIF.PDF_CONVERT_IMAGE_TYPE)));
	            }
            }

		}
		catch (IOException e)
		{
			e.printStackTrace();
		}
	    catch(Exception e)
	    {
	    	e.printStackTrace();
	    }
	}
}


text:
build(){

    if command_exists "mvn" && [[ "$1" != *"-"* ]] && [[ "$1" != *"SNAPSHOT"* ]] && [[ "$1" != *"2.0"* ]]; then
        echo "Build started with MAVEN"
        build_via_mvn $1 $2
    elif [[ "$1" == *"SNAPSHOT"* ]]; then
        echo "Build by clone/pull github develop branch"
        if command_exists "ant"; then
        build_via_git $1 $2
        else
            echo "Error: you must have at least ant installed"
            exit -1
        fi
    else
        echo "Build by download from github repository"
        if command_exists "ant"; then
            build_via_github $1 $2
        else
            echo "Error: you must have at least ant installed"
            exit -1
        fi
    fi

}

command_exists () {
  type "$1" >/dev/null 2>&1 ;
}

extract(){

    ODB_PACKAGE_PATH=$1
    filename=$(basename "${ODB_PACKAGE_PATH}")
    CI_DIR=$2

    echo "Extract archive: ${filename}"
    if [ ${filename#*tar.gz} ]; then
        # empty string found, means no tar archive extension found
        echo "unzip -q ${ODB_PACKAGE_PATH} -d ${CI_DIR}"
        unzip -q ${ODB_PACKAGE_PATH} -d ${CI_DIR}
    elif [ ${filename#*zip} ]; then
        # empty string found, means no zip archive extension found
        echo "tar xf ${ODB_PACKAGE_PATH} -C ${CI_DIR}"
        tar xf ${ODB_PACKAGE_PATH} -C ${CI_DIR}
    else
        echo "Unknown file type"
        exit 1
    fi;

    echo "rm -rf ${ODB_PACKAGE_PATH}"
    rm -rf ${ODB_PACKAGE_PATH}

}

download () {
    OUTPUT_DIR=$2
    PACKAGE_NAME=$3

    if [ ! -d "$OUTPUT_DIR" ]; then
        mkdir "$OUTPUT_DIR"
    fi

    if command_exists "wget" ; then
        echo "wget -q -O $OUTPUT_DIR/$PACKAGE_NAME $1"
        wget -q -O "$OUTPUT_DIR/$PACKAGE_NAME" "$1"
    elif command_exists "curl" ; then
        echo "cd ${OUTPUT_DIR}"
        cd ${OUTPUT_DIR}
        echo "curl --silent -L -o "$OUTPUT_DIR/$PACKAGE_NAME" $1"
        curl --silent -L -o "$OUTPUT_DIR/$PACKAGE_NAME" $1
    else
        echo "Cannot download $1 [missing wget or curl]"
        exit 1
    fi
}

build_via_git (){

    ODB_VERSION=$1
    CI_DIR=$2

    cd ${CI_DIR}
    if [ ! -d "orientdb-develop" ]; then
        echo "No git clone found."
        echo "git clone https://github.com/orientechnologies/orientdb.git orientdb-develop"
        git clone https://github.com/orientechnologies/orientdb.git orientdb-develop
        cd orientdb-develop
        git checkout develop
    else
        echo "Git clone found. Updating."
        cd orientdb-develop
        git checkout develop
    fi

    git pull origin develop
    ant clean install

    echo "mv ${CI_DIR}/releases/* ${CI_DIR}"
    mv ${CI_DIR}/releases/* ${CI_DIR}

    echo "rm -rf ${CI_DIR}/releases"
    rm -rf ${CI_DIR}/releases

}

build_via_github (){

    ODB_VERSION=$1
    CI_DIR=$2
    OUTPUT_DIR="${2:-$(pwd)}"

    ODB_COMPILED_NAME="orientdb-community-${ODB_VERSION}"
    ODB_ARCHIVED_NAME="orientdb-${ODB_VERSION}"
    ODB_PACKAGE_EXT="tar.gz"
    ODB_COMPRESSED=${ODB_COMPILED_NAME}.${ODB_PACKAGE_EXT}

    GITHUB_URL="https://github.com/orientechnologies/orientdb/archive/${ODB_VERSION}.${ODB_PACKAGE_EXT}"

    download ${GITHUB_URL} ${OUTPUT_DIR} ${ODB_COMPRESSED}

    ODB_PACKAGE_PATH="${CI_DIR}/${ODB_COMPRESSED}"

    echo "Extract package"
    extract ${ODB_PACKAGE_PATH} ${CI_DIR}

    echo "cd ${CI_DIR}/${ODB_ARCHIVED_NAME}"
    cd "${CI_DIR}/${ODB_ARCHIVED_NAME}"

    ant clean install

    echo "mv ${CI_DIR}/releases/* ${CI_DIR}"
    mv ${CI_DIR}/releases/* ${CI_DIR}

    echo "rm -rf ${CI_DIR}/releases"
    rm -rf ${CI_DIR}/releases

    echo "rm -rf ${CI_DIR}/${ODB_ARCHIVED_NAME}"
    rm -rf ${CI_DIR}/${ODB_ARCHIVED_NAME}

}

build_via_mvn () {

    ODB_VERSION=$1
    CI_DIR=$2

    ODB_COMPILED_NAME="orientdb-community-${ODB_VERSION}"

    ODB_PACKAGE_EXT="tar.gz"
    ODB_COMPRESSED=${ODB_COMPILED_NAME}.${ODB_PACKAGE_EXT}

    OUTPUT_DIR="${2:-$(pwd)}"

    if [ ! -d "$OUTPUT_DIR" ]; then
        mkdir "$OUTPUT_DIR"
    fi

    if command_exists "mvn" ; then
        echo "mvn org.apache.maven.plugins:maven-dependency-plugin:2.8:get -Dartifact=com.orientechnologies:orientdb-community:\"${ODB_VERSION}\":\"${ODB_PACKAGE_EXT}\":distribution -DremoteRepositories=https://oss.sonatype.org/content/repositories/snapshots/ -Ddest=\"$OUTPUT_DIR/$ODB_COMPRESSED\""
        mvn org.apache.maven.plugins:maven-dependency-plugin:2.8:get -Dartifact=com.orientechnologies:orientdb-community:"${ODB_VERSION}":"${ODB_PACKAGE_EXT}":distribution -DremoteRepositories=https://oss.sonatype.org/content/repositories/snapshots/ -Ddest="$OUTPUT_DIR/$ODB_COMPRESSED"
    else
        echo "Cannot download $1 [maven is not installed]"
        exit 1
    fi

    ODB_PACKAGE_PATH="${CI_DIR}/${ODB_COMPILED_NAME}.${ODB_PACKAGE_EXT}"

    echo "Extract package"
    extract ${ODB_PACKAGE_PATH} ${CI_DIR}

}


text:
php app/console doctrine:mapping:convert yaml ./src/IFC/IfcBundle/Resources/config/doctrine/metadata/orm --from-database --force

# Cria classes de entidade
php app/console doctrine:mapping:import IFCIfcBundle annotation
php app/console doctrine:generate:entities IFCIfcBundle


text:
import check from './support/check';
import validate from './support/validate';
import assertError from './support/assertError';

function checkOptionalChaining(source: string, expected: string): void {
  check(source, expected, { options: { optionalChaining: true } });
}

const testFunctionApplication = false; // TODO

describe('soaked expressions', () => {
  describe('function application', () => {
    if (!testFunctionApplication) return;
    it('works with a basic function', () => {
      checkOptionalChaining(
        `
        a = null
        a?()
      `,
        `
        const a = null;
        a?.();
      `
      );
    });

    it('works with a function that is not safe to repeat', () => {
      checkOptionalChaining(
        `
        a()?()
      `,
        `
        a()?.();
      `
      );
    });

    it('works in an expression context', () => {
      checkOptionalChaining(
        `
        a(b()?())
      `,
        `
        a(b()?.());
      `
      );
    });

    it('preserves arguments', () => {
      checkOptionalChaining(
        `
        a()?(1, 2, 3)
      `,
        `
        a()?.(1, 2, 3);
      `
      );
    });

    it('handles nested soaked function calls', () => {
      checkOptionalChaining(
        `
        a = null
        a?(1)?(2)
      `,
        `
        const a = null;
        a?.(1)?.(2);
      `
      );
    });

    it('works with repeatable member access as the function', () => {
      checkOptionalChaining(
        `
        a.b?()
      `,
        `
        if (typeof a.b === 'function') {
          a.b();
        }
      `
      );
    });

    it('works with non-repeatable member access as the function', () => {
      checkOptionalChaining(
        `
        a().b?()
      `,
        `
        __guardMethod__(a(), 'b', o => o.b());
        function __guardMethod__(obj, methodName, transform) {
          if (typeof obj !== 'undefined' && obj !== null && typeof obj[methodName] === 'function') {
            return transform(obj, methodName);
          } else {
            return undefined;
          }
        }
      `
      );
    });

    it('works with repeatable dynamic member access as the function', () => {
      checkOptionalChaining(
        `
        a[b]?()
      `,
        `
        if (typeof a[b] === 'function') {
          a[b]();
        }
      `
      );
    });

    it('works with non-repeatable dynamic member access as the function', () => {
      checkOptionalChaining(
        `
        a()[b]?()
      `,
        `
        __guardMethod__(a(), b, (o, m) => o[m]());
        function __guardMethod__(obj, methodName, transform) {
          if (typeof obj !== 'undefined' && obj !== null && typeof obj[methodName] === 'function') {
            return transform(obj, methodName);
          } else {
            return undefined;
          }
        }
      `
      );
    });

    it('works with dynamic member access whose key is unsafe to repeat as the function', () => {
      checkOptionalChaining(
        `
        a[b()]?()
      `,
        `
        __guardMethod__(a, b(), (o, m) => o[m]());
        function __guardMethod__(obj, methodName, transform) {
          if (typeof obj !== 'undefined' && obj !== null && typeof obj[methodName] === 'function') {
            return transform(obj, methodName);
          } else {
            return undefined;
          }
        }
      `
      );
    });

    it('allows undeclared variables for soaked function calls in an expression context', () => {
      checkOptionalChaining(
        `
        a = b?()
      `,
        `
        const a = typeof b === 'function' ? b() : undefined;
      `
      );
    });

    it('does not crash when using a soaked member access on an undeclared variable', () => {
      validate(
        `
        a?.b
        setResult(true)
      `,
        true,
        { options: { optionalChaining: true } }
      );
    });

    it('does not crash when using a soaked dynamic member access on an undeclared variable', () => {
      validate(
        `
        a?['b']
        setResult(true)
      `,
        true,
        { options: { optionalChaining: true } }
      );
    });

    it('does not crash when using a soaked function invocation on an undeclared variable', () => {
      validate(
        `
        a?()
        setResult(true)
      `,
        true,
        { options: { optionalChaining: true } }
      );
    });

    it('evaluates soaked function calls', () => {
      validate(
        `
        f = -> 3
        setResult(f?())
      `,
        3,
        { options: { optionalChaining: true } }
      );
    });

    it('properly sets this in soaked method calls', () => {
      validate(
        `
        o = false
        a = {
          b: ->
            if a == this
              o = true
        }
        a.b?()
        setResult(o)
      `,
        true,
        { options: { optionalChaining: true } }
      );
    });

    it('properly sets `this` in shorthand-`this` soaked method calls', () => {
      validate(
        `
        o = false
        a = {
          b: ->
            @c?()
          c: ->
            if a == this
              o = true
        }
        a.b()
        setResult(o)
      `,
        true,
        { options: { optionalChaining: true } }
      );
    });

    it('properly sets `this` in soaked dynamic method calls', () => {
      validate(
        `
        o = false
        a = {
          b: ->
            if a == this
              o = true
        }
        a['b']?()
        setResult(o)
      `,
        true,
        { options: { optionalChaining: true } }
      );
    });
  });

  describe('soaked member access', () => {
    it('handles soaked member access assignment', () => {
      assertError(
        `
        canvasContext = null
        canvasContext?.font = $('body').css('font')
      `,
        'JavaScript does not allow an optional chaining expression in an assignment position. Run without --optional-chaining or edit the original source to remove the assignment of an optional chaining expression.',
        { optionalChaining: true }
      );
    });

    it('handles soaked member access with conflicting variable names', () => {
      checkOptionalChaining(
        `
        x = 5
        a()?.b(x)
      `,
        `
        const x = 5;
        a()?.b(x);
      `
      );
    });

    it('disallows soaked member access with assignment within an expression', () => {
      assertError(
        `
        b = null
        a(b?.c = d)
      `,
        'JavaScript does not allow an optional chaining expression in an assignment position. Run without --optional-chaining or edit the original source to remove the assignment of an optional chaining expression.',
        { optionalChaining: true }
      );
    });

    it('handles soaked member access with a function call', () => {
      checkOptionalChaining(
        `
        a = null
        a?.b()
      `,
        `
        const a = null;
        a?.b();
      `
      );
    });

    it('handles soaked member access on the result of a function call', () => {
      checkOptionalChaining(
        `
        a.b()?.c
      `,
        `
        a.b()?.c;
      `
      );
    });

    it('allows soaked member access to be used in an expression', () => {
      checkOptionalChaining(
        `
        b = null
        a(b?.c)
      `,
        `
        const b = null;
        a(b?.c);
      `
      );
    });

    it('handles dynamic member access', () => {
      checkOptionalChaining(
        `
        a = null
        a?[b]()
      `,
        `
        const a = null;
        a?.[b]();
      `
      );
    });

    it('handles soaked dynamic member access followed by normal dynamic member access', () => {
      checkOptionalChaining(
        `
        a = null
        a?[b].c[d]
      `,
        `
        const a = null;
        a?.[b].c[d];
      `
      );
    });

    it('handles nested soaked dynamic member access', () => {
      checkOptionalChaining(
        `
        a = null
        a?[b].c?[d]
      `,
        `
        const a = null;
        a?.[b].c?.[d];
      `
      );
    });

    it('allows undeclared variables for soaked dynamic member accesses in an expression context', () => {
      checkOptionalChaining(
        `
        a = b?[c]
      `,
        `
        const a = b?.[c];
      `
      );
    });

    it('uses a shorter check for declared variables for soaked dynamic member accesses in an expression context', () => {
      checkOptionalChaining(
        `
        b = {}
        a = b?[c]
      `,
        `
        const b = {};
        const a = b?.[c];
      `
      );
    });

    it('handles soaked member access within a condition', () => {
      checkOptionalChaining(
        `
        a = null
        if a?.b then c
      `,
        `
        const a = null;
        if (a?.b) { c; }
      `
      );
    });

    it('handles explicit parens around soaks', () => {
      checkOptionalChaining(
        `
        a = null
        (a?.b).c
      `,
        `
        const a = null;
        (a?.b).c;
      `
      );
    });

    it('fails when used with postfix operation', () => {
      assertError(
        `
        a()?.b++
      `,
        'JavaScript does not allow an optional chaining expression in an assignment position. Run without --optional-chaining or edit the original source to remove the assignment of an optional chaining expression.',
        { optionalChaining: true }
      );

      assertError(
        `
        a()?.b--
      `,
        'JavaScript does not allow an optional chaining expression in an assignment position. Run without --optional-chaining or edit the original source to remove the assignment of an optional chaining expression.',
        { optionalChaining: true }
      );

      assertError(
        `
        ++a()?.b
      `,
        'JavaScript does not allow an optional chaining expression in an assignment position. Run without --optional-chaining or edit the original source to remove the assignment of an optional chaining expression.',
        { optionalChaining: true }
      );

      assertError(
        `
        --a()?.b
      `,
        'JavaScript does not allow an optional chaining expression in an assignment position. Run without --optional-chaining or edit the original source to remove the assignment of an optional chaining expression.',
        { optionalChaining: true }
      );

      assertError(
        `
        ++(a())?[b]
      `,
        'JavaScript does not allow an optional chaining expression in an assignment position. Run without --optional-chaining or edit the original source to remove the assignment of an optional chaining expression.',
        { optionalChaining: true }
      );

      assertError(
        `
        --(a())?[b]
      `,
        'JavaScript does not allow an optional chaining expression in an assignment position. Run without --optional-chaining or edit the original source to remove the assignment of an optional chaining expression.',
        { optionalChaining: true }
      );

      assertError(
        `
        ++a()?(b).c
      `,
        'JavaScript does not allow an optional chaining expression in an assignment position. Run without --optional-chaining or edit the original source to remove the assignment of an optional chaining expression.',
        { optionalChaining: true }
      );

      assertError(
        `
        --a()?(b).c
      `,
        'JavaScript does not allow an optional chaining expression in an assignment position. Run without --optional-chaining or edit the original source to remove the assignment of an optional chaining expression.',
        { optionalChaining: true }
      );
    });

    it('allows assignment with an ancestor of a soak outside a function boundary', () => {
      checkOptionalChaining(
        `
        (-> a?.b).c++
        `,
        `
        ((() => a?.b)).c++;
        `
      );

      checkOptionalChaining(
        `
        a[b?.c]++
        `,
        `
        a[b?.c]++;
        `
      );
    });

    it('keeps delete within soak expressions', () => {
      checkOptionalChaining(
        `
        delete a()?.b
      `,
        `
        delete a()?.b;
      `
      );
    });

    it('handles soaked prototype access', () => {
      checkOptionalChaining(
        `
        a()?::b
      `,
        `
        a()?.prototype.b;
      `
      );
    });

    it('correctly handles normal soaked access', () => {
      validate(
        `
        a = {b: 5}
        setResult(a?.b)
      `,
        5
      );
    });

    it('correctly handles missing soaked access', () => {
      validate(
        `
        a = {b: null}
        setResult('' + a.b?.c)
      `,
        'undefined'
      );
    });

    it('correctly handles dynamic soaked access', () => {
      validate(
        `
        a = {b: 5}
        setResult(a?['b'])
      `,
        5
      );
    });

    it('correctly handles missing dynamic soaked access', () => {
      validate(
        `
        a = {b: null}
        setResult('' + a.b?['c'])
      `,
        'undefined'
      );
    });

    it('stops evaluating the expression when hitting a soak failure', () => {
      validate(
        `
        a = {b: 5}
        setResult('' + a.d?.e.f())
      `,
        'undefined'
      );
    });
  });

  it('handles a soaked method call on a soaked member access', () => {
    checkOptionalChaining(
      `
      a = {}
      a?.b?()
    `,
      `
      const a = {};
      a?.b?.();
    `
    );
  });

  it('handles a soaked method call on a soaked dynamic member access', () => {
    checkOptionalChaining(
      `
      a = null
      a?[b]?()
    `,
      `
      const a = null;
      a?.[b]?.();
    `
    );
  });

  it('handles a combination of soaked function calls and soaked member accesses', () => {
    checkOptionalChaining(
      `
      a = null
      a?(1)?.b?()?[c].d?()?.e
    `,
      `
      const a = null;
      a?.(1)?.b?.()?.[c].d?.()?.e;
    `
    );
  });

  it('properly sets patching bounds for soaked function applications', () => {
    checkOptionalChaining(
      `
      f()?(a,
        b: c
        d: e)
    `,
      `
      f()?.(a, {
        b: c,
        d: e
      });
    `
    );
  });

  it('properly transforms an `in` operator with a soak expression on the left', () => {
    checkOptionalChaining(
      `
      a = null
      a?.b in c
    `,
      `
      const a = null;
      Array.from(c).includes(a?.b);
    `
    );
  });

  it('properly transforms an `in` operator with a soak expression on the right', () => {
    checkOptionalChaining(
      `
      b = null
      a in b?.c
    `,
      `
      const b = null;
      Array.from(b?.c).includes(a);
    `
    );
  });

  it('handles a soaked access used with an existence operator', () => {
    checkOptionalChaining(
      `
      a = b()?.c ? d
    `,
      `
      let left;
      const a = (left = b()?.c) != null ? left : d;
    `
    );
  });

  it('handles a soaked dynamic access used with an existence operator', () => {
    checkOptionalChaining(
      `
      a = b()?[c()] ? d
    `,
      `
      let left;
      const a = (left = b()?.[c()]) != null ? left : d;
    `
    );
  });

  it('fails with nullish coalescing assignment', () => {
    assertError(
      `
      a()?.b ?= c
    `,
      'JavaScript does not allow an optional chaining expression in an assignment position. Run without --optional-chaining or edit the original source to remove the assignment of an optional chaining expression.',
      { optionalChaining: true }
    );

    assertError(
      `
      a()?[b()] ?= d
    `,
      'JavaScript does not allow an optional chaining expression in an assignment position. Run without --optional-chaining or edit the original source to remove the assignment of an optional chaining expression.',
      { optionalChaining: true }
    );

    assertError(
      `
      a()?.b and= c
    `,
      'JavaScript does not allow an optional chaining expression in an assignment position. Run without --optional-chaining or edit the original source to remove the assignment of an optional chaining expression.',
      { optionalChaining: true }
    );

    assertError(
      `
      a()?[b()] and= d
    `,
      'JavaScript does not allow an optional chaining expression in an assignment position. Run without --optional-chaining or edit the original source to remove the assignment of an optional chaining expression.',
      { optionalChaining: true }
    );

    assertError(
      `
      a.b()?.c or= (it) -> it
    `,
      'JavaScript does not allow an optional chaining expression in an assignment position. Run without --optional-chaining or edit the original source to remove the assignment of an optional chaining expression.',
      { optionalChaining: true }
    );
  });

  it('allows a repeated soak operation as a loop target', () => {
    checkOptionalChaining(
      `
      i + j for j, i in foo()?.bar ? []
    `,
      `
      let left;
      const iterable = (left = foo()?.bar) != null ? left : [];
      for (let i = 0; i < iterable.length; i++) { const j = iterable[i]; i + j; }
    `
    );
  });

  it('handles a possibly undeclared variable in a statement context', () => {
    checkOptionalChaining(
      `
      a?.b[c()]()
    `,
      `
      a?.b[c()]();
    `
    );
  });

  it('handles a simple identifier that has been declared in a statement context', () => {
    checkOptionalChaining(
      `
      a = f()
      a?.b[c()]
    `,
      `
      const a = f();
      a?.b[c()];
    `
    );
  });

  it('properly follows precedence with soak expressions', () => {
    checkOptionalChaining(
      `
      a = f()
      x = a?.b or []
    `,
      `
      const a = f();
      const x = a?.b || [];
    `
    );
  });

  it('properly handles chained simple soak operations', () => {
    checkOptionalChaining(
      `
      a = f()
      if a?.b?.c?
        d
    `,
      `
      const a = f();
      if (a?.b?.c != null) {
        d;
      }
    `
    );
  });

  it('properly handles a soaked method call followed by a binary exists op', () => {
    checkOptionalChaining(
      `
      b = null
      a = b?.filter(-> c) ? null
    `,
      `
      let left;
      const b = null;
      const a = (left = b?.filter(() => c)) != null ? left : null;
    `
    );
  });

  it('properly handles a soak operation inside a ternary', () => {
    checkOptionalChaining(
      `
      b = 0
      a = if b?.c then d else e
    `,
      `
      const b = 0;
      const a = b?.c ? d : e;
    `
    );
  });

  it('has the correct runtime behavior with a soak operation inside a ternary', () => {
    validate(
      `
      a = {b: 'should not return'}
      setResult(if a?.b then 'should return')
    `,
      'should return',
      { options: { optionalChaining: true }, skipNodeCheck: true }
    );
  });

  it('does not add parens around a soaked while condition', () => {
    checkOptionalChaining(
      `
      a = {}
      while a?.b
        break
    `,
      `
      const a = {};
      while (a?.b) {
        break;
      }
    `
    );
  });

  it('does not add parens around a soaked indexing expression', () => {
    checkOptionalChaining(
      `
      a = {}
      b = {}
      d = a[b?.c]
    `,
      `
      const a = {};
      const b = {};
      const d = a[b?.c];
    `
    );
  });

  it('properly handles a soaked condition in an `unless` statement', () => {
    checkOptionalChaining(
      `
      a = null
      unless a?.b
        c
    `,
      `
      const a = null;
      if (!a?.b) {
        c;
      }
    `
    );
  });

  it('properly handles a soaked condition in an `until` statement', () => {
    checkOptionalChaining(
      `
      a = null
      until a?.b
        c
    `,
      `
      const a = null;
      while (!a?.b) {
        c;
      }
    `
    );
  });

  it('properly handles a soaked condition in an `unless` statement with an assignment', () => {
    checkOptionalChaining(
      `
      b = null
      unless a = b?.c
        d
    `,
      `
      let a;
      const b = null;
      if (!(a = b?.c)) {
        d;
      }
    `
    );
  });

  it('properly patches the object key in a soaked dynamic member access', () => {
    checkOptionalChaining(
      `
      a = null
      a?[@b]
    `,
      `
      const a = null;
      a?.[this.b];
    `
    );
  });

  it('properly places parens for expression-style soaked assignment', () => {
    assertError(
      `
      b = null
      a = b?.c = 1
    `,
      'JavaScript does not allow an optional chaining expression in an assignment position. Run without --optional-chaining or edit the original source to remove the assignment of an optional chaining expression.',
      { optionalChaining: true }
    );
  });

  it('fails with soaked new operations', () => {
    assertError(
      `
      A = null
      new A?(b)
    `,
      'JavaScript does not allow constructors with optional chaining. Run without --optional-chaining or edit the original source to manually invoke the constructor conditionally.',
      { optionalChaining: true }
    );

    assertError(
      `
      A = null
      new A? b
    `,
      'JavaScript does not allow constructors with optional chaining. Run without --optional-chaining or edit the original source to manually invoke the constructor conditionally.',
      { optionalChaining: true }
    );

    assertError(
      `
      new A[b()]?(c)
    `,
      'JavaScript does not allow constructors with optional chaining. Run without --optional-chaining or edit the original source to manually invoke the constructor conditionally.',
      { optionalChaining: true }
    );
  });

  it('handles soaked slice operations', () => {
    checkOptionalChaining(
      `
      a = b?[c..d]
    `,
      `
      const a = b?.slice(c, +d + 1 || undefined);
    `
    );
  });

  it('properly computes the soak container for soaked slice operations', () => {
    checkOptionalChaining(
      `
      a = b?[c..d].e
    `,
      `
      const a = b?.slice(c, +d + 1 || undefined).e;
    `
    );
  });

  it('handles soaked splice operations', () => {
    checkOptionalChaining(
      `
      a?[b..c] = d
    `,
      `
      a?.splice(b, c - b + 1, ...[].concat(d));
    `
    );
  });

  it('handles complex splice operations', () => {
    checkOptionalChaining(
      `
      [a, b()?[c..]] = d
    `,
      `
      let a;
      a = d[0], b()?.splice(c, 9e9, ...[].concat(d[1]));
    `
    );
  });

  it('handles a parenthesized soak operation within `unless`', () => {
    checkOptionalChaining(
      `
      a = {b: 1}
      unless (a?.b)
        c
    `,
      `
      const a = {b: 1};
      if (!a?.b) {
        c;
      }
    `
    );
  });

  it('handles a nested parenthesized soak operation within `unless`', () => {
    checkOptionalChaining(
      `
      a = {b: 1}
      unless (a?.b.c)
        d
    `,
      `
      const a = {b: 1};
      if (!a?.b.c) {
        d;
      }
    `
    );
  });

  it('handles a parenthesized soak operation within `until`', () => {
    checkOptionalChaining(
      `
      a = {b: 1}
      until (a?.b)
        c
    `,
      `
      const a = {b: 1};
      while (!a?.b) {
        c;
      }
    `
    );
  });

  it('handles a parenthesized soak operation within a negated logical operator', () => {
    checkOptionalChaining(
      `
      a = {b: 1}
      unless c and (a?.b)
        d
    `,
      `
      const a = {b: 1};
      if (!c || (!a?.b)) {
        d;
      }
    `
    );
  });

  it('handles a parenthesized soak operation within a negated switch case', () => {
    checkOptionalChaining(
      `
      a = {b: 1}
      switch
        when (a?.b)
          c
    `,
      `
      const a = {b: 1};
      switch (false) {
        case (!a?.b):
          c;
          break;
      }
    `
    );
  });
});


text:
import Graph from 'graphology-types';
import {NoverlapSettings, NoverlapNodeReducer} from './index';

export type NoverlapLayoutSupervisorParameters = {
  inputReducer?: NoverlapNodeReducer;
  outputReducer?: NoverlapNodeReducer;
  onConverged?: () => void;
  settings?: NoverlapSettings;
};

export default class NoverlapLayoutSupervisor {
  converged: boolean;

  constructor(graph: Graph, params?: NoverlapLayoutSupervisorParameters);

  isRunning(): boolean;
  start(): void;
  stop(): void;
  kill(): void;
}


text:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.Linq;
using Windows.Foundation.Collections;

namespace xBindSampleModel
{
    public sealed class VectorChangedEventArgs : IVectorChangedEventArgs
    {
        public CollectionChange CollectionChange { get; set; }
        public uint Index { get; set; }
    }

    //Implements both IObservableVector and INotifyCollectionChanged and as its used from both C++ and C# apps
    public sealed class EmployeeCollection : Windows.Foundation.Collections.IObservableVector<IEmployee>, IList<IEmployee>, INotifyCollectionChanged, IList
    {
        private ObservableCollection<IEmployee> data;
        public event VectorChangedEventHandler<IEmployee> VectorChanged;
        public event NotifyCollectionChangedEventHandler CollectionChanged;

        public EmployeeCollection()
        {
            data = new ObservableCollection<IEmployee>();
            data.CollectionChanged += Data_CollectionChanged;
        }

        private void Data_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            if (VectorChanged != null)
            {
                VectorChangedEventArgs args = new VectorChangedEventArgs();
                args.CollectionChange = CollectionChange.Reset;
                VectorChanged(this, args);
            }

            if (CollectionChanged != null)
            {
                CollectionChanged(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
                CollectionChanged(this, e);
            }
        }

        #region IObservableVector
        //IObservableVector derives from IList<T> so most of the interface members are strongly typed

        public IEmployee this[int index]
        {
            get { return data[index]; }
            set { data[index] = value; }
        }

        public int Count { get { return data.Count; } }
        public bool IsReadOnly { get { return false; } }

        public void Add(IEmployee item)
        {
            data.Add(item);
        }

        public void Clear()
        {
            data.Clear();
        }
        public bool Contains(IEmployee item)
        {
            return data.Contains(item);
        }

        public void CopyTo(IEmployee[] array, int arrayIndex)
        {
            data.CopyTo(array, arrayIndex);
        }
        public IEnumerator<IEmployee> GetEnumerator() { return data.GetEnumerator(); }

        public int IndexOf(IEmployee item) { return data.IndexOf(item); }

        public void Insert(int index, IEmployee item)
        {
            data.Insert(index, item);
        }

        public bool Remove(IEmployee item)
        {
            return data.Remove(item);
        }

        public void RemoveAt(int index)
        {
            data.RemoveAt(index);
        }

        IEnumerator IEnumerable.GetEnumerator()
        {
            return data.GetEnumerator();
        }
        #endregion

        #region INotifyCollectionChanged
        //INotifyCollection changed inherits from IList (non generic) so most of its members are not strongly typed

        object IList.this[int index]
        {
            get { return data[index]; }
            set { data[index] = (Employee)value; }
        }

        int ICollection.Count { get { return data.Count; } }
        bool IList.IsFixedSize { get { return false; } }
        bool ICollection.IsSynchronized { get { return false; } }
        object ICollection.SyncRoot { get { throw new NotImplementedException(); } }

        int IList.Add(object item)
        {
            data.Add((IEmployee)item);
            return data.Count;
        }

        bool IList.IsReadOnly { get { return false; } }

        bool IList.Contains(object item) { return data.Contains(item); }

        int IList.IndexOf(object item) { return data.IndexOf((IEmployee)item); }

        void IList.Insert(int index, object item)
        {
            data.Insert(index, (IEmployee)item);
        }

        void IList.Remove(object item)
        {
            data.Remove((IEmployee)item);
        }

        void IList.Clear()
        {
            data.Clear();
        }

        void IList.RemoveAt(int index)
        {
            data.RemoveAt(index);
        }

        void ICollection.CopyTo(Array array, int index)
        {
            throw new NotImplementedException();
        }
        #endregion
    }

    internal class MapChangedEventArgs<K> : IMapChangedEventArgs<K>
    {
        public CollectionChange CollectionChange { get; set; }
        public K Key { get; set; }
    }

    public sealed class EmployeeDictionary : IDictionary<string, IEmployee>, IObservableMap<string, IEmployee>
    {
        private Dictionary<string, IEmployee> data = new Dictionary<string, IEmployee>();
        #region IObservable MAP
        public event MapChangedEventHandler<string, IEmployee> MapChanged;

        private void FireMapChanged(CollectionChange change, string key)
        {
            if (MapChanged != null)
            {
                MapChanged(this, new MapChangedEventArgs<string>() { CollectionChange = change, Key = key });
            }
        }

        #endregion

        #region Generic Dictionary
        public IEmployee this[string key]
        {
            get
            {
                return data[key];
            }
            set
            {
                data[key] = value;
                FireMapChanged(CollectionChange.ItemChanged, key);
            }
        }

        public int Count { get { return data.Count; } }

        public bool IsReadOnly { get { return false; } }

        public ICollection<string> Keys { get { return data.Keys; } }

        public ICollection<IEmployee> Values { get { return data.Values; } }

        public void Add(KeyValuePair<string, IEmployee> item)
        {
            data.Add(item.Key, item.Value);
            FireMapChanged(CollectionChange.ItemInserted, item.Key);
        }

        public void Add(string key, IEmployee value)
        {
            data.Add(key, value);
            FireMapChanged(CollectionChange.ItemInserted, key);
        }

        public void Clear()
        {
            data.Clear();
            FireMapChanged(CollectionChange.Reset, default(string));
        }

        public bool Contains(KeyValuePair<string, IEmployee> item) { return data.Contains(item); }

        public bool ContainsKey(string key) { return data.ContainsKey(key); }

        public void CopyTo(KeyValuePair<string, IEmployee>[] array, int arrayIndex)
        {
            var keys = data.Keys.GetEnumerator();
            var values = data.Values.GetEnumerator();
            for (int i = 0; i < data.Count; i++)
            {
                KeyValuePair<string, IEmployee> pair = new KeyValuePair<string, IEmployee>(keys.Current, values.Current);
                array[arrayIndex + i] = pair;
                keys.MoveNext();
                values.MoveNext();
            }
        }

        public IEnumerator<KeyValuePair<string, IEmployee>> GetEnumerator() { return data.GetEnumerator(); }

        public bool Remove(KeyValuePair<string, IEmployee> item) { return Remove(item.Key); }

        public bool Remove(string key)
        {
            bool removed = data.Remove(key);
            if (removed) { FireMapChanged(CollectionChange.ItemRemoved, key); }
            return removed;
        }

        public bool TryGetValue(string key, out IEmployee value)
        {
            return data.TryGetValue(key, out value);
        }

        IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)data).GetEnumerator(); }
        #endregion

    }

}


text:
<?php

class ITSEC_Four_Oh_Four {

	private
		$settings;

	function run() {

		$this->settings = get_site_option( 'itsec_four_oh_four' );

		add_filter( 'itsec_lockout_modules', array( $this, 'register_lockout' ) );
		add_filter( 'itsec_logger_modules', array( $this, 'register_logger' ) );

		add_action( 'wp_head', array( $this, 'check_404' ) );

	}

	/**
	 * If the page is a WordPress 404 error log it and register for lockout
	 *
	 * @return void
	 */
	public function check_404() {

		global $itsec_logger, $itsec_lockout;

		if ( $this->settings['enabled'] === true && is_404() ) {

			$uri = explode( '?', $_SERVER['REQUEST_URI'] );

			if ( isset( $this->settings['white_list'] ) && ! is_array( $this->settings['white_list'] ) ) {
				$this->settings['white_list'] = explode( PHP_EOL, $this->settings['white_list'] );
			} elseif ( ! isset( $this->settings['white_list'] ) ) {
				$this->settings['white_list'] = array();
			}

			if ( in_array( $uri[0], $this->settings['white_list'] ) === false ) {

				$itsec_logger->log_event(
				             'four_oh_four',
				             3,
				             array(
					             'query_string' => isset( $uri[1] ) ? esc_sql( $uri[1] ) : '',
				             ),
				             ITSEC_Lib::get_ip(),
				             '',
				             '',
				             esc_sql( $uri[0] ),
				             isset( $_SERVER['HTTP_REFERER'] ) ? esc_sql( $_SERVER['HTTP_REFERER'] ) : ''
				);

				$path_info = pathinfo( $uri[0] );

				if ( ! isset( $path_info['extension'] ) || ( isset( $this->settings['types'] ) && is_array( $this->settings['types'] ) && in_array( '.' . $path_info['extension'], $this->settings['types'] ) === false ) ) {

					$itsec_lockout->do_lockout( 'four_oh_four' );

				}

			}

		}

	}

	/**
	 * Register 404 detection for lockout
	 *
	 * @param  array $lockout_modules array of lockout modules
	 *
	 * @return array                   array of lockout modules
	 */
	public function register_lockout( $lockout_modules ) {

		if ( $this->settings['enabled'] === true ) {

			$lockout_modules['four_oh_four'] = array(
				'type'   => 'four_oh_four',
				'reason' => __( 'too many attempts to access a file that does not exist', 'it-l10n-better-wp-security' ),
				'host'   => $this->settings['error_threshold'],
				'period' => $this->settings['check_period']
			);

		}

		return $lockout_modules;

	}

	/**
	 * Register 404 and file change detection for logger
	 *
	 * @param  array $logger_modules array of logger modules
	 *
	 * @return array                   array of logger modules
	 */
	public function register_logger( $logger_modules ) {

		if ( $this->settings['enabled'] === true ) {

			$logger_modules['four_oh_four'] = array(
				'type'     => 'four_oh_four',
				'function' => __( '404 Error', 'it-l10n-better-wp-security' ),
			);

		}

		return $logger_modules;

	}

}


text:
package auth

import (
	"net/http"
	"time"
)

// LoginUser sets a cookie to log in a user
func LoginUser(uuid string, rememberMe bool, res http.ResponseWriter) {
	var dur time.Duration
	var maxAge int

	if rememberMe {
		dur = longSession
		maxAge = 0
	} else {
		dur = shortSession
		maxAge = int(dur.Seconds())
	}
	token, err := SessionToken(uuid, signingSecret, dur)
	if err != nil {
		panic(err)
	}
	cookie := &http.Cookie{
		Name:   cookieName,
		Value:  token,
		Path:   "/",
		Domain: "." + config.ExternalApex,
		MaxAge: maxAge,
	}
	http.SetCookie(res, cookie)
}

func getSession(req *http.Request) (uuid string, err error) {
	cookie, err := req.Cookie(cookieName)
	if err != nil {
		return
	}
	uuid, err = RetrieveSessionInformation(cookie.Value, signingSecret)
	return
}

// Logout forces an immediate logout of current user.
// for internal application - typically do an HTTP redirect
// to the www service '/logout/'
func Logout(res http.ResponseWriter) {
	cookie := &http.Cookie{
		Name:   cookieName,
		Value:  "",
		Path:   "/",
		MaxAge: -1,
		Domain: "." + config.ExternalApex,
	}
	http.SetCookie(res, cookie)
}


text:
@interface LITFileUtility : NSObject

// Returns the URL to the application's Documents directory.
+ (NSURL *)applicationDocumentsDirectory;

@end


text:
/**
*============================================================================
*  The Ohio State University Research Foundation, Emory University,
*  the University of Minnesota Supercomputing Institute
*
*  Distributed under the OSI-approved BSD 3-Clause License.
*  See http://ncip.github.com/cagrid-grid-incubation/LICENSE.txt for details.
*============================================================================
**/
/**
*============================================================================
*============================================================================
**/
package org.cagrid.mdrq.service.globus;

import java.rmi.RemoteException;
import java.util.HashMap;
import java.util.Map;
import java.io.File;
import javax.security.auth.Subject;
import javax.xml.namespace.QName;
import javax.xml.rpc.handler.MessageContext;

import gov.nih.nci.cagrid.introduce.servicetools.security.AuthorizationExtension;
import org.globus.wsrf.impl.security.authorization.exceptions.AuthorizationException;
import org.globus.wsrf.impl.security.authorization.exceptions.CloseException;
import org.globus.wsrf.impl.security.authorization.exceptions.InitializeException;
import org.globus.wsrf.impl.security.authorization.exceptions.InvalidPolicyException;
import org.globus.wsrf.security.authorization.PDP;
import org.globus.wsrf.security.authorization.PDPConfig;
import org.globus.wsrf.config.ContainerConfig;
import org.w3c.dom.Node;

/**
 * DO NOT EDIT:  This class is autogenerated!
 *
 * This is a PDP for use with the globus authorization callout.
 * This class will have a authorize method for each method on this grid service.
 * The method is responsibe for making any authorization callouts required to satisfy the
 * authorization requirements placed on each method call.  Each method will either return
 * apon a successful authorization or will throw an exception apon a failed authorization.
 *
 * @created by Introduce Toolkit version 1.3
 *
 */
public class MDRQueryAuthorization implements PDP {

	public static final String SERVICE_NAMESPACE = "http://mdrq.cagrid.org/MDRQuery";

	Map authorizationClassMap = new HashMap();

	public MDRQueryAuthorization() {
	}

	protected String getServiceNamespace(){
		return SERVICE_NAMESPACE;
	}

	public static String getCallerIdentity() {
		String caller = org.globus.wsrf.security.SecurityManager.getManager().getCaller();
		if ((caller == null) || (caller.equals("<anonymous>"))) {
			return null;
		} else {
			return caller;
		}
	}

	public void authorizeGetMultipleResourceProperties(Subject peerSubject, MessageContext context, QName operation) throws AuthorizationException {

	}

	public void authorizeGetResourceProperty(Subject peerSubject, MessageContext context, QName operation) throws AuthorizationException {

	}

	public void authorizeQueryResourceProperties(Subject peerSubject, MessageContext context, QName operation) throws AuthorizationException {

	}

	public void authorizeGetServiceSecurityMetadata(Subject peerSubject, MessageContext context, QName operation) throws AuthorizationException {

	}

	public void authorizeQuery(Subject peerSubject, MessageContext context, QName operation) throws AuthorizationException {

	}

	public void authorizeGetQueryResources(Subject peerSubject, MessageContext context, QName operation) throws AuthorizationException {

	}

	public boolean isPermitted(Subject peerSubject, MessageContext context, QName operation)
		throws AuthorizationException {

		if(!operation.getNamespaceURI().equals(getServiceNamespace())){
		  return false;
		}
		if(operation.getLocalPart().equals("getMultipleResourceProperties")){
			authorizeGetMultipleResourceProperties(peerSubject, context, operation);
			return true;
		} else if(operation.getLocalPart().equals("getResourceProperty")){
			authorizeGetResourceProperty(peerSubject, context, operation);
			return true;
		} else if(operation.getLocalPart().equals("queryResourceProperties")){
			authorizeQueryResourceProperties(peerSubject, context, operation);
			return true;
		} else if(operation.getLocalPart().equals("getServiceSecurityMetadata")){
			authorizeGetServiceSecurityMetadata(peerSubject, context, operation);
			return true;
		} else if(operation.getLocalPart().equals("query")){
			authorizeQuery(peerSubject, context, operation);
			return true;
		} else if(operation.getLocalPart().equals("getQueryResources")){
			authorizeGetQueryResources(peerSubject, context, operation);
			return true;
		}
		return false;
	}

	public Node getPolicy(Node query) throws InvalidPolicyException {
		return null;
	}

	public String[] getPolicyNames() {
		return null;
	}

	public Node setPolicy(Node policy) throws InvalidPolicyException {
		return null;
	}

	public void close() throws CloseException {

	}

	public void initialize(PDPConfig config, String name, String id) throws InitializeException {
    	try{
    		String serviceName = (String)config.getProperty(name, "serviceName");
    	    String etcPath = ContainerConfig.getBaseDirectory() + File.separator + (String)config.getProperty(name, "etcDirectoryPath");

    	} catch (Exception e){
        	throw new InitializeException(e.getMessage(),e);
		}
	}

}