text:
#if !defined(ERL_NIF_API_FUNC_DECL) && !defined(ERL_NIF_API_FUNC_MACRO)
#  error This file should not be included directly
#endif

#ifdef ERL_NIF_API_FUNC_DECL
ERL_NIF_API_FUNC_DECL(void*,enif_priv_data,(ErlNifEnv*));
ERL_NIF_API_FUNC_DECL(void*,enif_alloc,(size_t size));
ERL_NIF_API_FUNC_DECL(void,enif_free,(void* ptr));
ERL_NIF_API_FUNC_DECL(int,enif_is_atom,(ErlNifEnv*, ERL_NIF_TERM term));
ERL_NIF_API_FUNC_DECL(int,enif_is_binary,(ErlNifEnv*, ERL_NIF_TERM term));
ERL_NIF_API_FUNC_DECL(int,enif_is_ref,(ErlNifEnv*, ERL_NIF_TERM term));
ERL_NIF_API_FUNC_DECL(int,enif_inspect_binary,(ErlNifEnv*, ERL_NIF_TERM bin_term, ErlNifBinary* bin));
ERL_NIF_API_FUNC_DECL(int,enif_alloc_binary,(size_t size, ErlNifBinary* bin));
ERL_NIF_API_FUNC_DECL(int,enif_realloc_binary,(ErlNifBinary* bin, size_t size));
ERL_NIF_API_FUNC_DECL(void,enif_release_binary,(ErlNifBinary* bin));
ERL_NIF_API_FUNC_DECL(int,enif_get_int,(ErlNifEnv*, ERL_NIF_TERM term, int* ip));
ERL_NIF_API_FUNC_DECL(int,enif_get_ulong,(ErlNifEnv*, ERL_NIF_TERM term, unsigned long* ip));
ERL_NIF_API_FUNC_DECL(int,enif_get_double,(ErlNifEnv*, ERL_NIF_TERM term, double* dp));
ERL_NIF_API_FUNC_DECL(int,enif_get_list_cell,(ErlNifEnv* env, ERL_NIF_TERM term, ERL_NIF_TERM* head, ERL_NIF_TERM* tail));
ERL_NIF_API_FUNC_DECL(int,enif_get_tuple,(ErlNifEnv* env, ERL_NIF_TERM tpl, int* arity, const ERL_NIF_TERM** array));
ERL_NIF_API_FUNC_DECL(int,enif_is_identical,(ERL_NIF_TERM lhs, ERL_NIF_TERM rhs));
ERL_NIF_API_FUNC_DECL(int,enif_compare,(ERL_NIF_TERM lhs, ERL_NIF_TERM rhs));
ERL_NIF_API_FUNC_DECL(ERL_NIF_TERM,enif_make_binary,(ErlNifEnv* env, ErlNifBinary* bin));
ERL_NIF_API_FUNC_DECL(ERL_NIF_TERM,enif_make_badarg,(ErlNifEnv* env));
ERL_NIF_API_FUNC_DECL(ERL_NIF_TERM,enif_make_int,(ErlNifEnv* env, int i));
ERL_NIF_API_FUNC_DECL(ERL_NIF_TERM,enif_make_ulong,(ErlNifEnv* env, unsigned long i));
ERL_NIF_API_FUNC_DECL(ERL_NIF_TERM,enif_make_double,(ErlNifEnv* env, double d));
ERL_NIF_API_FUNC_DECL(ERL_NIF_TERM,enif_make_atom,(ErlNifEnv* env, const char* name));
ERL_NIF_API_FUNC_DECL(int,enif_make_existing_atom,(ErlNifEnv* env, const char* name, ERL_NIF_TERM* atom, ErlNifCharEncoding));
ERL_NIF_API_FUNC_DECL(ERL_NIF_TERM,enif_make_tuple,(ErlNifEnv* env, unsigned cnt, ...));
ERL_NIF_API_FUNC_DECL(ERL_NIF_TERM,enif_make_list,(ErlNifEnv* env, unsigned cnt, ...));
ERL_NIF_API_FUNC_DECL(ERL_NIF_TERM,enif_make_list_cell,(ErlNifEnv* env, ERL_NIF_TERM car, ERL_NIF_TERM cdr));
ERL_NIF_API_FUNC_DECL(ERL_NIF_TERM,enif_make_string,(ErlNifEnv* env, const char* string, ErlNifCharEncoding));
ERL_NIF_API_FUNC_DECL(ERL_NIF_TERM,enif_make_ref,(ErlNifEnv* env));

ERL_NIF_API_FUNC_DECL(ErlNifMutex*,enif_mutex_create,(char *name));
ERL_NIF_API_FUNC_DECL(void,enif_mutex_destroy,(ErlNifMutex *mtx));
ERL_NIF_API_FUNC_DECL(int,enif_mutex_trylock,(ErlNifMutex *mtx));
ERL_NIF_API_FUNC_DECL(void,enif_mutex_lock,(ErlNifMutex *mtx));
ERL_NIF_API_FUNC_DECL(void,enif_mutex_unlock,(ErlNifMutex *mtx));
ERL_NIF_API_FUNC_DECL(ErlNifCond*,enif_cond_create,(char *name));
ERL_NIF_API_FUNC_DECL(void,enif_cond_destroy,(ErlNifCond *cnd));
ERL_NIF_API_FUNC_DECL(void,enif_cond_signal,(ErlNifCond *cnd));
ERL_NIF_API_FUNC_DECL(void,enif_cond_broadcast,(ErlNifCond *cnd));
ERL_NIF_API_FUNC_DECL(void,enif_cond_wait,(ErlNifCond *cnd, ErlNifMutex *mtx));
ERL_NIF_API_FUNC_DECL(ErlNifRWLock*,enif_rwlock_create,(char *name));
ERL_NIF_API_FUNC_DECL(void,enif_rwlock_destroy,(ErlNifRWLock *rwlck));
ERL_NIF_API_FUNC_DECL(int,enif_rwlock_tryrlock,(ErlNifRWLock *rwlck));
ERL_NIF_API_FUNC_DECL(void,enif_rwlock_rlock,(ErlNifRWLock *rwlck));
ERL_NIF_API_FUNC_DECL(void,enif_rwlock_runlock,(ErlNifRWLock *rwlck));
ERL_NIF_API_FUNC_DECL(int,enif_rwlock_tryrwlock,(ErlNifRWLock *rwlck));
ERL_NIF_API_FUNC_DECL(void,enif_rwlock_rwlock,(ErlNifRWLock *rwlck));
ERL_NIF_API_FUNC_DECL(void,enif_rwlock_rwunlock,(ErlNifRWLock *rwlck));
ERL_NIF_API_FUNC_DECL(int,enif_tsd_key_create,(char *name, ErlNifTSDKey *key));
ERL_NIF_API_FUNC_DECL(void,enif_tsd_key_destroy,(ErlNifTSDKey key));
ERL_NIF_API_FUNC_DECL(void,enif_tsd_set,(ErlNifTSDKey key, void *data));
ERL_NIF_API_FUNC_DECL(void*,enif_tsd_get,(ErlNifTSDKey key));
ERL_NIF_API_FUNC_DECL(ErlNifThreadOpts*,enif_thread_opts_create,(char *name));
ERL_NIF_API_FUNC_DECL(void,enif_thread_opts_destroy,(ErlNifThreadOpts *opts));
ERL_NIF_API_FUNC_DECL(int,enif_thread_create,(char *name,ErlNifTid *tid,void * (*func)(void *),void *args,ErlNifThreadOpts *opts));
ERL_NIF_API_FUNC_DECL(ErlNifTid,enif_thread_self,(void));
ERL_NIF_API_FUNC_DECL(int,enif_equal_tids,(ErlNifTid tid1, ErlNifTid tid2));
ERL_NIF_API_FUNC_DECL(void,enif_thread_exit,(void *resp));
ERL_NIF_API_FUNC_DECL(int,enif_thread_join,(ErlNifTid, void **respp));

ERL_NIF_API_FUNC_DECL(void*,enif_realloc,(void* ptr, size_t size));
ERL_NIF_API_FUNC_DECL(void,enif_system_info,(ErlNifSysInfo *sip, size_t si_size));
ERL_NIF_API_FUNC_DECL(int,enif_fprintf,(void/* FILE* */ *filep, const char *format, ...));
ERL_NIF_API_FUNC_DECL(int,enif_inspect_iolist_as_binary,(ErlNifEnv*, ERL_NIF_TERM term, ErlNifBinary* bin));
ERL_NIF_API_FUNC_DECL(ERL_NIF_TERM,enif_make_sub_binary,(ErlNifEnv*, ERL_NIF_TERM bin_term, size_t pos, size_t size));
ERL_NIF_API_FUNC_DECL(int,enif_get_string,(ErlNifEnv*, ERL_NIF_TERM list, char* buf, unsigned len, ErlNifCharEncoding));
ERL_NIF_API_FUNC_DECL(int,enif_get_atom,(ErlNifEnv*, ERL_NIF_TERM atom, char* buf, unsigned len, ErlNifCharEncoding));
ERL_NIF_API_FUNC_DECL(int,enif_is_fun,(ErlNifEnv*, ERL_NIF_TERM term));
ERL_NIF_API_FUNC_DECL(int,enif_is_pid,(ErlNifEnv*, ERL_NIF_TERM term));
ERL_NIF_API_FUNC_DECL(int,enif_is_port,(ErlNifEnv*, ERL_NIF_TERM term));
ERL_NIF_API_FUNC_DECL(int,enif_get_uint,(ErlNifEnv*, ERL_NIF_TERM term, unsigned* ip));
ERL_NIF_API_FUNC_DECL(int,enif_get_long,(ErlNifEnv*, ERL_NIF_TERM term, long* ip));
ERL_NIF_API_FUNC_DECL(ERL_NIF_TERM,enif_make_uint,(ErlNifEnv*, unsigned i));
ERL_NIF_API_FUNC_DECL(ERL_NIF_TERM,enif_make_long,(ErlNifEnv*, long i));
ERL_NIF_API_FUNC_DECL(ERL_NIF_TERM,enif_make_tuple_from_array,(ErlNifEnv*, const ERL_NIF_TERM arr[], unsigned cnt));
ERL_NIF_API_FUNC_DECL(ERL_NIF_TERM,enif_make_list_from_array,(ErlNifEnv*, const ERL_NIF_TERM arr[], unsigned cnt));
ERL_NIF_API_FUNC_DECL(int,enif_is_empty_list,(ErlNifEnv*, ERL_NIF_TERM term));
ERL_NIF_API_FUNC_DECL(ErlNifResourceType*,enif_open_resource_type,(ErlNifEnv*, const char* module_str, const char* name_str, void (*dtor)(ErlNifEnv*,void *), ErlNifResourceFlags flags, ErlNifResourceFlags* tried));
ERL_NIF_API_FUNC_DECL(void*,enif_alloc_resource,(ErlNifResourceType* type, size_t size));
ERL_NIF_API_FUNC_DECL(void,enif_release_resource,(void* obj));
ERL_NIF_API_FUNC_DECL(ERL_NIF_TERM,enif_make_resource,(ErlNifEnv*, void* obj));
ERL_NIF_API_FUNC_DECL(int,enif_get_resource,(ErlNifEnv*, ERL_NIF_TERM term, ErlNifResourceType* type, void** objp));
ERL_NIF_API_FUNC_DECL(size_t,enif_sizeof_resource,(void* obj));
ERL_NIF_API_FUNC_DECL(unsigned char*,enif_make_new_binary,(ErlNifEnv*,size_t size,ERL_NIF_TERM* termp));
ERL_NIF_API_FUNC_DECL(int,enif_is_list,(ErlNifEnv*, ERL_NIF_TERM term));
ERL_NIF_API_FUNC_DECL(int,enif_is_tuple,(ErlNifEnv*, ERL_NIF_TERM term));
ERL_NIF_API_FUNC_DECL(int,enif_get_atom_length,(ErlNifEnv*, ERL_NIF_TERM atom, unsigned* len, ErlNifCharEncoding));
ERL_NIF_API_FUNC_DECL(int,enif_get_list_length,(ErlNifEnv* env, ERL_NIF_TERM term, unsigned* len));
ERL_NIF_API_FUNC_DECL(ERL_NIF_TERM, enif_make_atom_len,(ErlNifEnv* env, const char* name, size_t len));
ERL_NIF_API_FUNC_DECL(int, enif_make_existing_atom_len,(ErlNifEnv* env, const char* name, size_t len, ERL_NIF_TERM* atom, ErlNifCharEncoding));
ERL_NIF_API_FUNC_DECL(ERL_NIF_TERM,enif_make_string_len,(ErlNifEnv* env, const char* string, size_t len, ErlNifCharEncoding));
ERL_NIF_API_FUNC_DECL(ErlNifEnv*,enif_alloc_env,(void));
ERL_NIF_API_FUNC_DECL(void,enif_free_env,(ErlNifEnv* env));
ERL_NIF_API_FUNC_DECL(void,enif_clear_env,(ErlNifEnv* env));
ERL_NIF_API_FUNC_DECL(int,enif_send,(ErlNifEnv* env, const ErlNifPid* to_pid, ErlNifEnv* msg_env, ERL_NIF_TERM msg));
ERL_NIF_API_FUNC_DECL(ERL_NIF_TERM,enif_make_copy,(ErlNifEnv* dst_env, ERL_NIF_TERM src_term));
ERL_NIF_API_FUNC_DECL(ErlNifPid*,enif_self,(ErlNifEnv* caller_env, ErlNifPid* pid));
ERL_NIF_API_FUNC_DECL(int,enif_get_local_pid,(ErlNifEnv* env, ERL_NIF_TERM, ErlNifPid* pid));
ERL_NIF_API_FUNC_DECL(void,enif_keep_resource,(void* obj));
ERL_NIF_API_FUNC_DECL(ERL_NIF_TERM,enif_make_resource_binary,(ErlNifEnv*,void* obj,const void* data, size_t size));
#if SIZEOF_LONG != 8
ERL_NIF_API_FUNC_DECL(int,enif_get_int64,(ErlNifEnv*, ERL_NIF_TERM term, ErlNifSInt64* ip));
ERL_NIF_API_FUNC_DECL(int,enif_get_uint64,(ErlNifEnv*, ERL_NIF_TERM term, ErlNifUInt64* ip));
ERL_NIF_API_FUNC_DECL(ERL_NIF_TERM,enif_make_int64,(ErlNifEnv*, ErlNifSInt64));
ERL_NIF_API_FUNC_DECL(ERL_NIF_TERM,enif_make_uint64,(ErlNifEnv*, ErlNifUInt64));
#endif

/*
** Add last to keep compatibility on Windows!!!
*/
#endif

#ifdef ERL_NIF_API_FUNC_MACRO
#  define enif_priv_data ERL_NIF_API_FUNC_MACRO(enif_priv_data)
#  define enif_alloc ERL_NIF_API_FUNC_MACRO(enif_alloc)
#  define enif_free ERL_NIF_API_FUNC_MACRO(enif_free)
#  define enif_is_atom ERL_NIF_API_FUNC_MACRO(enif_is_atom)
#  define enif_is_binary ERL_NIF_API_FUNC_MACRO(enif_is_binary)
#  define enif_is_ref ERL_NIF_API_FUNC_MACRO(enif_is_ref)
#  define enif_inspect_binary ERL_NIF_API_FUNC_MACRO(enif_inspect_binary)
#  define enif_alloc_binary ERL_NIF_API_FUNC_MACRO(enif_alloc_binary)
#  define enif_realloc_binary ERL_NIF_API_FUNC_MACRO(enif_realloc_binary)
#  define enif_release_binary ERL_NIF_API_FUNC_MACRO(enif_release_binary)
#  define enif_get_int ERL_NIF_API_FUNC_MACRO(enif_get_int)
#  define enif_get_ulong ERL_NIF_API_FUNC_MACRO(enif_get_ulong)
#  define enif_get_double ERL_NIF_API_FUNC_MACRO(enif_get_double)
#  define enif_get_tuple ERL_NIF_API_FUNC_MACRO(enif_get_tuple)
#  define enif_get_list_cell ERL_NIF_API_FUNC_MACRO(enif_get_list_cell)
#  define enif_is_identical ERL_NIF_API_FUNC_MACRO(enif_is_identical)
#  define enif_compare ERL_NIF_API_FUNC_MACRO(enif_compare)

#  define enif_make_binary ERL_NIF_API_FUNC_MACRO(enif_make_binary)
#  define enif_make_badarg ERL_NIF_API_FUNC_MACRO(enif_make_badarg)
#  define enif_make_int ERL_NIF_API_FUNC_MACRO(enif_make_int)
#  define enif_make_ulong ERL_NIF_API_FUNC_MACRO(enif_make_ulong)
#  define enif_make_double ERL_NIF_API_FUNC_MACRO(enif_make_double)
#  define enif_make_atom ERL_NIF_API_FUNC_MACRO(enif_make_atom)
#  define enif_make_existing_atom ERL_NIF_API_FUNC_MACRO(enif_make_existing_atom)
#  define enif_make_tuple ERL_NIF_API_FUNC_MACRO(enif_make_tuple)
#  define enif_make_list ERL_NIF_API_FUNC_MACRO(enif_make_list)
#  define enif_make_list_cell ERL_NIF_API_FUNC_MACRO(enif_make_list_cell)
#  define enif_make_string ERL_NIF_API_FUNC_MACRO(enif_make_string)
#  define enif_make_ref ERL_NIF_API_FUNC_MACRO(enif_make_ref)

#  define enif_mutex_create ERL_NIF_API_FUNC_MACRO(enif_mutex_create)
#  define enif_mutex_destroy ERL_NIF_API_FUNC_MACRO(enif_mutex_destroy)
#  define enif_mutex_trylock ERL_NIF_API_FUNC_MACRO(enif_mutex_trylock)
#  define enif_mutex_lock ERL_NIF_API_FUNC_MACRO(enif_mutex_lock)
#  define enif_mutex_unlock ERL_NIF_API_FUNC_MACRO(enif_mutex_unlock)
#  define enif_cond_create ERL_NIF_API_FUNC_MACRO(enif_cond_create)
#  define enif_cond_destroy ERL_NIF_API_FUNC_MACRO(enif_cond_destroy)
#  define enif_cond_signal ERL_NIF_API_FUNC_MACRO(enif_cond_signal)
#  define enif_cond_broadcast ERL_NIF_API_FUNC_MACRO(enif_cond_broadcast)
#  define enif_cond_wait ERL_NIF_API_FUNC_MACRO(enif_cond_wait)
#  define enif_rwlock_create ERL_NIF_API_FUNC_MACRO(enif_rwlock_create)
#  define enif_rwlock_destroy ERL_NIF_API_FUNC_MACRO(enif_rwlock_destroy)
#  define enif_rwlock_tryrlock ERL_NIF_API_FUNC_MACRO(enif_rwlock_tryrlock)
#  define enif_rwlock_rlock ERL_NIF_API_FUNC_MACRO(enif_rwlock_rlock)
#  define enif_rwlock_runlock ERL_NIF_API_FUNC_MACRO(enif_rwlock_runlock)
#  define enif_rwlock_tryrwlock ERL_NIF_API_FUNC_MACRO(enif_rwlock_tryrwlock)
#  define enif_rwlock_rwlock ERL_NIF_API_FUNC_MACRO(enif_rwlock_rwlock)
#  define enif_rwlock_rwunlock ERL_NIF_API_FUNC_MACRO(enif_rwlock_rwunlock)
#  define enif_tsd_key_create ERL_NIF_API_FUNC_MACRO(enif_tsd_key_create)
#  define enif_tsd_key_destroy ERL_NIF_API_FUNC_MACRO(enif_tsd_key_destroy)
#  define enif_tsd_set ERL_NIF_API_FUNC_MACRO(enif_tsd_set)
#  define enif_tsd_get ERL_NIF_API_FUNC_MACRO(enif_tsd_get)
#  define enif_thread_opts_create ERL_NIF_API_FUNC_MACRO(enif_thread_opts_create)
#  define enif_thread_opts_destroy ERL_NIF_API_FUNC_MACRO(enif_thread_opts_destroy)
#  define enif_thread_create ERL_NIF_API_FUNC_MACRO(enif_thread_create)
#  define enif_thread_self ERL_NIF_API_FUNC_MACRO(enif_thread_self)
#  define enif_equal_tids ERL_NIF_API_FUNC_MACRO(enif_equal_tids)
#  define enif_thread_exit ERL_NIF_API_FUNC_MACRO(enif_thread_exit)
#  define enif_thread_join ERL_NIF_API_FUNC_MACRO(enif_thread_join)

#  define enif_realloc ERL_NIF_API_FUNC_MACRO(enif_realloc)
#  define enif_system_info ERL_NIF_API_FUNC_MACRO(enif_system_info)
#  define enif_fprintf ERL_NIF_API_FUNC_MACRO(enif_fprintf)
#  define enif_inspect_iolist_as_binary ERL_NIF_API_FUNC_MACRO(enif_inspect_iolist_as_binary)
#  define enif_make_sub_binary ERL_NIF_API_FUNC_MACRO(enif_make_sub_binary)
#  define enif_get_string ERL_NIF_API_FUNC_MACRO(enif_get_string)
#  define enif_get_atom ERL_NIF_API_FUNC_MACRO(enif_get_atom)
#  define enif_is_fun ERL_NIF_API_FUNC_MACRO(enif_is_fun)
#  define enif_is_pid ERL_NIF_API_FUNC_MACRO(enif_is_pid)
#  define enif_is_port ERL_NIF_API_FUNC_MACRO(enif_is_port)
#  define enif_get_uint ERL_NIF_API_FUNC_MACRO(enif_get_uint)
#  define enif_get_long ERL_NIF_API_FUNC_MACRO(enif_get_long)
#  define enif_make_uint ERL_NIF_API_FUNC_MACRO(enif_make_uint)
#  define enif_make_long ERL_NIF_API_FUNC_MACRO(enif_make_long)
#  define enif_make_tuple_from_array ERL_NIF_API_FUNC_MACRO(enif_make_tuple_from_array)
#  define enif_make_list_from_array ERL_NIF_API_FUNC_MACRO(enif_make_list_from_array)
#  define enif_is_empty_list ERL_NIF_API_FUNC_MACRO(enif_is_empty_list)
#  define enif_open_resource_type ERL_NIF_API_FUNC_MACRO(enif_open_resource_type)
#  define enif_alloc_resource ERL_NIF_API_FUNC_MACRO(enif_alloc_resource)
#  define enif_release_resource ERL_NIF_API_FUNC_MACRO(enif_release_resource)
#  define enif_make_resource ERL_NIF_API_FUNC_MACRO(enif_make_resource)
#  define enif_get_resource ERL_NIF_API_FUNC_MACRO(enif_get_resource)
#  define enif_sizeof_resource ERL_NIF_API_FUNC_MACRO(enif_sizeof_resource)
#  define enif_make_new_binary ERL_NIF_API_FUNC_MACRO(enif_make_new_binary)
#  define enif_is_list ERL_NIF_API_FUNC_MACRO(enif_is_list)
#  define enif_is_tuple ERL_NIF_API_FUNC_MACRO(enif_is_tuple)
#  define enif_get_atom_length ERL_NIF_API_FUNC_MACRO(enif_get_atom_length)
#  define enif_get_list_length ERL_NIF_API_FUNC_MACRO(enif_get_list_length)
#  define enif_make_atom_len ERL_NIF_API_FUNC_MACRO(enif_make_atom_len)
#  define enif_make_existing_atom_len ERL_NIF_API_FUNC_MACRO(enif_make_existing_atom_len)
#  define enif_make_string_len ERL_NIF_API_FUNC_MACRO(enif_make_string_len)
#  define enif_alloc_env ERL_NIF_API_FUNC_MACRO(enif_alloc_env)
#  define enif_free_env ERL_NIF_API_FUNC_MACRO(enif_free_env)
#  define enif_clear_env ERL_NIF_API_FUNC_MACRO(enif_clear_env)
#  define enif_send ERL_NIF_API_FUNC_MACRO(enif_send)
#  define enif_make_copy ERL_NIF_API_FUNC_MACRO(enif_make_copy)
#  define enif_self ERL_NIF_API_FUNC_MACRO(enif_self)
#  define enif_get_local_pid ERL_NIF_API_FUNC_MACRO(enif_get_local_pid)
#  define enif_keep_resource ERL_NIF_API_FUNC_MACRO(enif_keep_resource)
#  define enif_make_resource_binary ERL_NIF_API_FUNC_MACRO(enif_make_resource_binary)
#if  SIZEOF_LONG != 8
#  define enif_get_int64 ERL_NIF_API_FUNC_MACRO(enif_get_int64)
#  define enif_get_uint64 ERL_NIF_API_FUNC_MACRO(enif_get_uint64)
#  define enif_make_int64 ERL_NIF_API_FUNC_MACRO(enif_make_int64)
#  define enif_make_uint64 ERL_NIF_API_FUNC_MACRO(enif_make_uint64)
#endif

#endif

#ifndef enif_make_list1
#  define enif_make_list1(ENV,E1) enif_make_list(ENV,1,E1)
#  define enif_make_list2(ENV,E1,E2) enif_make_list(ENV,2,E1,E2)
#  define enif_make_list3(ENV,E1,E2,E3) enif_make_list(ENV,3,E1,E2,E3)
#  define enif_make_list4(ENV,E1,E2,E3,E4) enif_make_list(ENV,4,E1,E2,E3,E4)
#  define enif_make_list5(ENV,E1,E2,E3,E4,E5) enif_make_list(ENV,5,E1,E2,E3,E4,E5)
#  define enif_make_list6(ENV,E1,E2,E3,E4,E5,E6) enif_make_list(ENV,6,E1,E2,E3,E4,E5,E6)
#  define enif_make_list7(ENV,E1,E2,E3,E4,E5,E6,E7) enif_make_list(ENV,7,E1,E2,E3,E4,E5,E6,E7)
#  define enif_make_list8(ENV,E1,E2,E3,E4,E5,E6,E7,E8) enif_make_list(ENV,8,E1,E2,E3,E4,E5,E6,E7,E8)
#  define enif_make_list9(ENV,E1,E2,E3,E4,E5,E6,E7,E8,E9) enif_make_list(ENV,9,E1,E2,E3,E4,E5,E6,E7,E8,E9)
#  define enif_make_tuple1(ENV,E1) enif_make_tuple(ENV,1,E1)
#  define enif_make_tuple2(ENV,E1,E2) enif_make_tuple(ENV,2,E1,E2)
#  define enif_make_tuple3(ENV,E1,E2,E3) enif_make_tuple(ENV,3,E1,E2,E3)
#  define enif_make_tuple4(ENV,E1,E2,E3,E4) enif_make_tuple(ENV,4,E1,E2,E3,E4)
#  define enif_make_tuple5(ENV,E1,E2,E3,E4,E5) enif_make_tuple(ENV,5,E1,E2,E3,E4,E5)
#  define enif_make_tuple6(ENV,E1,E2,E3,E4,E5,E6) enif_make_tuple(ENV,6,E1,E2,E3,E4,E5,E6)
#  define enif_make_tuple7(ENV,E1,E2,E3,E4,E5,E6,E7) enif_make_tuple(ENV,7,E1,E2,E3,E4,E5,E6,E7)
#  define enif_make_tuple8(ENV,E1,E2,E3,E4,E5,E6,E7,E8) enif_make_tuple(ENV,8,E1,E2,E3,E4,E5,E6,E7,E8)
#  define enif_make_tuple9(ENV,E1,E2,E3,E4,E5,E6,E7,E8,E9) enif_make_tuple(ENV,9,E1,E2,E3,E4,E5,E6,E7,E8,E9)

#  define enif_make_pid(ENV, PID) ((const ERL_NIF_TERM)((PID)->pid))

#if SIZEOF_LONG == 8
#  define enif_get_int64 enif_get_long
#  define enif_get_uint64 enif_get_ulong
#  define enif_make_int64 enif_make_long
#  define enif_make_uint64 enif_make_ulong
#endif

#endif


text:
#include "src/core/lib/iomgr/port.h"

#ifdef GRPC_WINSOCK_SOCKET

#include "src/core/lib/debug/trace.h"

grpc_core::TraceFlag grpc_polling_trace(false,
                                        "polling"); /* Disabled by default */

#endif  // GRPC_WINSOCK_SOCKET

redpajama_set_name: RedPajamaGithub


text:
package ai.elimu.web.context;

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

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;

import org.apache.commons.lang.StringUtils;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;
import org.springframework.core.io.Resource;
import org.springframework.web.context.ConfigurableWebApplicationContext;
import org.springframework.web.context.ContextLoaderListener;
import org.springframework.web.context.support.ServletContextResourceLoader;

import ai.elimu.model.enums.Environment;

/**
 * Use {@code WebApplicationContextUtils.getWebApplicationContext(servletContext)}
 * to access this listener anywhere in the web application, outside of the framework.
 */
public class EnvironmentContextLoaderListener extends ContextLoaderListener {

    public static Environment env = Environment.DEV;

    public final static Properties PROPERTIES = new Properties();

    private Logger logger = Logger.getLogger(getClass());

    /**
     * Note that environment-specific config.properties and
     * jdbc.properties files only require properties with _different_ values than
     * the default one. The file log4j.properties, however, requires <b>all</b>
     * properties to be present!
     */
    @Override
    public void contextInitialized(ServletContextEvent event) {
    	logger.info("contextInitialized");

        ServletContext servletContext = event.getServletContext();

        // Fetch attribute set in the corresponding context file at jetty.home/contexts/
        String envAttr = (String) servletContext.getAttribute("env");
        if (StringUtils.isNotBlank(envAttr)) {
            env = Environment.valueOf(envAttr);
        }
        logger.info("env: " + env);
        PROPERTIES.put("env", env);

        if ((env == Environment.TEST) || (env == Environment.PROD)) {
            // Clear existing Log4j configuration
            LogManager.resetConfiguration();

            ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
            URL environmentSpecificLog4JFile = classLoader.getResource(env + "_log4j.properties");
            new PropertyConfigurator().doConfigure(environmentSpecificLog4JFile, LogManager.getLoggerRepository());
            logger = Logger.getLogger(getClass());
            logger.info("environmentSpecificLog4JFile: " + environmentSpecificLog4JFile);
        }

        super.contextInitialized(event);
    }

    @Override
    protected void customizeContext(ServletContext servletContext, ConfigurableWebApplicationContext applicationContext) {
    	logger.info("contextInitialized");

        // Load default settings
        try {
            Resource resourceConfig = new ServletContextResourceLoader(servletContext).getResource("classpath:config.properties");
            PROPERTIES.load(resourceConfig.getInputStream());

            Resource resourceJdbc = new ServletContextResourceLoader(servletContext).getResource("classpath:jdbc.properties");
            PROPERTIES.load(resourceJdbc.getInputStream());

            logger.debug("properties (before overriding): " + PROPERTIES);
        } catch (IOException ex) {
            logger.error(null, ex);
        }

        if ((env == Environment.TEST) || (env == Environment.PROD)) {
        	InputStream inputStream = null;
            try {
                // Override config.properties
            	Resource resourceConfig = new ServletContextResourceLoader(servletContext).getResource("classpath:" + env + "_config.properties");
                PROPERTIES.load(resourceConfig.getInputStream());

                // Override jdbc.properties
                Resource resourceJdbc = new ServletContextResourceLoader(servletContext).getResource("classpath:" + env + "_jdbc.properties");
                PROPERTIES.load(resourceJdbc.getInputStream());

                String jdbcPasswordAttr = (String) servletContext.getAttribute("jdbc_password");
                PROPERTIES.put("jdbc.password", jdbcPasswordAttr);

                String googleApiSecret = (String) servletContext.getAttribute("google_api_secret");
                PROPERTIES.put("google.api.secret", googleApiSecret);

                String facebookApiSecret = (String) servletContext.getAttribute("facebook_api_secret");
                PROPERTIES.put("facebook.api.secret", facebookApiSecret);

                String gitHubApiSecret = (String) servletContext.getAttribute("github_api_secret");
                PROPERTIES.put("github.api.secret", gitHubApiSecret);

                if (env == Environment.PROD) {
                    String mailChimpApiKey = (String) servletContext.getAttribute("mailchimp_api_key");
                    PROPERTIES.put("mailchimp.api.key", mailChimpApiKey);

                    String slackApiToken = (String) servletContext.getAttribute("slack_api_token");
                    PROPERTIES.put("slack.api.token", slackApiToken);
                }

                String appstoreSecret = (String) servletContext.getAttribute("appstore_secret");
                PROPERTIES.put("appstore.secret", appstoreSecret);

                logger.debug("properties (after overriding): " + PROPERTIES);
            } catch (FileNotFoundException ex) {
                logger.error(null, ex);
            } catch (IOException ex) {
                logger.error(null, ex);
            } finally {
                try {
                    if (inputStream != null) {
                        inputStream.close();
                    }
                } catch (IOException ex) {
                    logger.error(null, ex);
                }
            }

            PropertyPlaceholderConfigurer propertyPlaceholderConfigurer = new PropertyPlaceholderConfigurer();
            propertyPlaceholderConfigurer.setProperties(PROPERTIES);
            applicationContext.addBeanFactoryPostProcessor(new BeanFactoryPostProcessor() {
                @Override
                public void postProcessBeanFactory(ConfigurableListableBeanFactory configurableListableBeanFactory) throws BeansException {
                    PropertyPlaceholderConfigurer propertyPlaceholderConfigurer = new PropertyPlaceholderConfigurer();
                    propertyPlaceholderConfigurer.setProperties(PROPERTIES);
                    propertyPlaceholderConfigurer.postProcessBeanFactory(configurableListableBeanFactory);
                }
            });
        }

        // Add config properties to application scope
        servletContext.setAttribute("configProperties", PROPERTIES);

        super.customizeContext(servletContext, applicationContext);
    }
}


text:
<!DOCTYPE html>
<html>
  <head>
    <title>Panoramic View of JSONParser</title>
  </head>
  <body>
    <img src="JSONParser.gif" style="width:70%;height:70%;" alt="" />
  </body>
</html>


text:
<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the Closure to execute when that URI is requested.
|
*/

Route::get('/', function()
{
	View::make('index');
});

//API ROUTES

Route::group(array('prefix' => 'api'), function() {
	Route::resource('comments', 'CommentController',
		array('only' => array('index', 'store', 'destroy')));
});

//CATCH ALL ROUTE ====
//all routes that are not home or api will be redirected here

App::missing(function($exception) {
	return View::make('index');
});


text:
cask "adobe-acrobat-reader" do
  version "21.007.20099"
  sha256 "7e2476096b067e04f2c0667c3ddd28512a8cbff1c13f69f9ae2a66192477001f"

  url "https://ardownload2.adobe.com/pub/adobe/reader/mac/AcrobatDC/#{version.no_dots}/AcroRdrDC_#{version.no_dots}_MUI.dmg"
  name "Adobe Acrobat Reader DC"
  desc "View, print, and comment on PDF documents"
  homepage "https://acrobat.adobe.com/us/en/acrobat/pdf-reader.html"

  livecheck do
    url "https://armmf.adobe.com/arm-manifests/mac/AcrobatDC/reader/current_version.txt"
    regex(/(\d+(?:\.\d+)+)/i)
  end

  auto_updates true

  pkg "AcroRdrDC_#{version.no_dots}_MUI.pkg"

  uninstall pkgutil:   [
    "com.adobe.acrobat.DC.reader.*",
    "com.adobe.armdc.app.pkg",
    "com.adobe.RdrServicesUpdater",
  ],
            delete:    "/Applications/Adobe Acrobat Reader DC.app",
            quit:      [
              "com.adobe.AdobeRdrCEF",
              "com.adobe.AdobeRdrCEFHelper",
              "com.adobe.Reader",
            ],
            launchctl: [
              "com.adobe.ARMDC.Communicator",
              "com.adobe.ARMDC.SMJobBlessHelper",
              "com.adobe.ARMDCHelper.cc24aef4a1b90ed56a725c38014c95072f92651fb65e1bf9c8e43c37a23d420d",
            ]

  zap trash: [
    "~/Library/Caches/com.adobe.Reader",
    "~/Library/HTTPStorages/com.adobe.Reader.binarycookies",
    "~/Library/Preferences/com.adobe.AdobeRdrCEFHelper.plist",
    "~/Library/Preferences/com.adobe.crashreporter.plist",
    "~/Library/Preferences/com.adobe.Reader.plist",
    "/Library/Preferences/com.adobe.reader.DC.WebResource.plist",
  ]
end


text:
from ansible.module_utils.basic import *  # NOQA
from os.path import basename

def main():

    module = AnsibleModule(
        argument_spec=dict(
            use_ssh_key=dict(
                type='bool',
                required=False,
                default=True),
            deployment_ssh_key=dict(
                type='str',
                required=False,
                default='/var/lib/jenkins/.ssh/id_rsa'),
            cli_path=dict(
                type='str',
                required=False,
                default='/var/lib/jenkins/jenkins-cli.jar'),
            groovy_scripts_path=dict(
                type='str',
                required=False,
                default='/var/lib/jenkins/groovy_scripts'),
            url=dict(
                type='str',
                required=False,
                default='http://localhost:8080')
        )
    )

    jenkins_cli_path = module.params['cli_path']
    jenkins_url = module.params['url']
    deployment_ssh_key = module.params['deployment_ssh_key']

    script = "%s/get_jenkins_plugins.groovy" % (
        module.params['groovy_scripts_path'])

    if module.params['use_ssh_key'] is False:
        rc, stdout, stderr = module.run_command(
            "java -jar %s -remoting -s '%s' -noKeyAuth groovy %s" %
            (jenkins_cli_path, jenkins_url, script))
    else:
        rc, stdout, stderr = module.run_command(
            "java -jar %s -remoting -s '%s' -i '%s' groovy %s" %
            (jenkins_cli_path, jenkins_url, deployment_ssh_key, script))

    if (rc != 0):
        module.fail_json(msg=stderr)

    print stdout

if __name__ == '__main__':
    main()


text:
* Add "glance" function. Keybinds already in place. Some functionality needs to be moved from old status outputs into appropriate places, like mag ammo check.
* Add room descriptions. Need to figure out data structure for this.
* Clean up help function to not destroy existing text output.

## Planned features

* **Enemies**
* **Aiming**
* **Advanced Movement** (move, move fast, dodge)
* **Combined Actions** (move + shoot, dodge + reload, etc)
* **Time System** (each action takes x.xx[random] seconds)


text:
package org.keycloak.testsuite.admin;

import org.junit.Test;
import org.keycloak.common.Version;
import org.keycloak.representations.idm.RealmRepresentation;
import org.keycloak.representations.info.ProviderRepresentation;
import org.keycloak.representations.info.ServerInfoRepresentation;
import org.keycloak.testsuite.AbstractKeycloakTest;

import java.util.List;
import java.util.Map;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import org.keycloak.testsuite.arquillian.annotation.AuthServerContainerExclude;
import org.keycloak.testsuite.arquillian.annotation.AuthServerContainerExclude.AuthServer;

/**
 * @author Stian Thorgersen
 */
@AuthServerContainerExclude(AuthServer.REMOTE)
public class ServerInfoTest extends AbstractKeycloakTest {

    @Test
    public void testServerInfo() {
        ServerInfoRepresentation info = adminClient.serverInfo().getInfo();
        assertNotNull(info);

        assertNotNull(info.getProviders());
        assertNotNull(info.getProviders().get("realm"));
        assertNotNull(info.getProviders().get("user"));
        assertNotNull(info.getProviders().get("authenticator"));

        assertNotNull(info.getThemes());
        assertNotNull(info.getThemes().get("account"));
        assertNotNull(info.getThemes().get("admin"));
        assertNotNull(info.getThemes().get("email"));
        assertNotNull(info.getThemes().get("login"));
        assertNotNull(info.getThemes().get("welcome"));

        assertNotNull(info.getEnums());

        assertNotNull(info.getMemoryInfo());
        assertNotNull(info.getSystemInfo());

        assertEquals(Version.VERSION, info.getSystemInfo().getVersion());
        assertNotNull(info.getSystemInfo().getServerTime());
        assertNotNull(info.getSystemInfo().getUptime());

        Map<String, ProviderRepresentation> jpaProviders = info.getProviders().get("connectionsJpa").getProviders();
        ProviderRepresentation jpaProvider = jpaProviders.values().iterator().next();
        log.infof("JPA Connections provider info: %s", jpaProvider.getOperationalInfo());
    }

    @Override
    public void addTestRealms(List<RealmRepresentation> testRealms) {
    }
}


text:
/**
 * Select2 <fa> translation.
 *
 * Author: Ali Choopan <choopan@arsh.co>
 */
(function ($) {
    "use strict";

    $.extend($.fn.select2.defaults, {
        formatNoMatches: function () { return "نتیجه‌ای یافت نشد."; },
        formatInputTooShort: function (input, min) { var n = min - input.length; return " لطفا بیش از"+n+"کاراکتر وارد نمایید "; },
        formatInputTooLong: function (input, max) { var n = input.length - max; return " لطفا" + n + " کاراکتر را حذف کنید."; },
        formatSelectionTooBig: function (limit) { return "شما فقط می‌توانید " + limit + " مورد را انتخاب کنید"; },
        formatLoadMore: function (pageNumber) { return "در حال بارگذاری موارد بیشتر ..."; },
        formatSearching: function () { return "در حال جستجو"; }
    });
})(jQuery);


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace Hello
{
    public class Program
    {
        public void Main(string[] args)
        {
            Console.Write("Hello");
            Console.ReadKey();
        }
    }
}


text:
package org.glob3.mobile.generated;
public abstract class Effect
{

  protected static double pace(double f)
  {
    if (f < 0)
       return 0;
    if (f > 1)
       return 1;

    //const double result = gently(f, 0.6, 0.85);
    final double result = gently(f, 0.25, 0.75);
    if (result < 0)
       return 0;
    if (result > 1)
       return 1;
    return result;
  }

  protected static double sigmoid(double x)
  {
    x = 12.0 *x - 6.0;
    return (1.0 / (1.0 + IMathUtils.instance().exp(-1.0 * x)));
  }

  protected static double gently(double x, double lower, double upper)
  {
    final double uperSquared = upper * upper;
    final double lowerPerUper = lower * upper;
    final double tmp = uperSquared - lowerPerUper + lower - 1;

    if (x < lower)
    {
      return ((upper - 1) / (lower * tmp)) * x * x;
    }

    if (x > upper)
    {
      final double a3 = 1 / tmp;
      final double b3 = -2 * a3;
      final double c3 = 1 + a3;
      return (a3 * x * x) + (b3 * x) + c3;
    }

    final double m = 2 * (upper - 1) / tmp;
    final double b2 = (0 - m) * lower / 2;
    return m * x + b2;
  }

  public abstract void start(G3MRenderContext rc, TimeInterval when);

  public abstract void doStep(G3MRenderContext rc, TimeInterval when);

  public abstract boolean isDone(G3MRenderContext rc, TimeInterval when);

  public abstract void stop(G3MRenderContext rc, TimeInterval when);

  public abstract void cancel(TimeInterval when);

  public void dispose()
  {

  }
}


text:
package com.github.maven_nar;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import org.apache.bcel.classfile.ClassFormatException;
import org.apache.bcel.classfile.JavaClass;
import org.apache.bcel.classfile.Method;
import org.apache.maven.artifact.DependencyResolutionRequiredException;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.toolchain.Toolchain;
import org.apache.maven.toolchain.ToolchainManager;
import org.codehaus.plexus.compiler.util.scan.InclusionScanException;
import org.codehaus.plexus.compiler.util.scan.SourceInclusionScanner;
import org.codehaus.plexus.compiler.util.scan.StaleSourceScanner;
import org.codehaus.plexus.compiler.util.scan.mapping.SingleTargetSourceMapping;
import org.codehaus.plexus.compiler.util.scan.mapping.SuffixMapping;
import org.codehaus.plexus.util.FileUtils;
import org.codehaus.plexus.util.StringUtils;

/**
 * Sets up the javah configuration
 *
 * @author Mark Donszelmann
 */
public class Javah {

  /**
   * Javah command to run.
   */
  @Parameter(defaultValue = "javah")
  private String name = "javah";

  /**
   * Skip javah.
   */
  @Parameter
  private boolean skip = false;

  /**
   * Add boot class paths. By default none.
   */
  @Parameter
  private List/* <File> */bootClassPaths = new ArrayList();

  /**
   * Add class paths. By default the classDirectory directory is included and
   * all dependent classes.
   */
  @Parameter
  private List/* <File> */classPaths = new ArrayList();

  /**
   * The target directory into which to generate the output.
   */
  @Parameter(defaultValue = "${project.build.directory}/nar/javah-include", required = true)
  private File jniDirectory;

  /**
   * The class directory to scan for class files with native interfaces.
   */
  @Parameter(defaultValue = "${project.build.directory}/classes", required = true)
  private File classDirectory;

  /**
   * The set of files/patterns to include Defaults to "**\/*.class"
   */
  @Parameter
  private Set includes = new HashSet();

  /**
   * A list of exclusion filters.
   */
  @Parameter
  private Set excludes = new HashSet();

  /**
   * A list of class names e.g. from java.sql.* that are also passed to javah.
   */
  @Parameter
  private Set extraClasses = new HashSet();

  /**
   * The granularity in milliseconds of the last modification date for testing
   * whether a source needs recompilation
   */
  @Parameter(defaultValue = "0", required = true)
  private int staleMillis = 0;

  /**
   * The directory to store the timestampfile for the processed aid files.
   * Defaults to jniDirectory.
   */
  @Parameter
  private File timestampDirectory;

  /**
   * The timestampfile for the processed class files. Defaults to name of javah.
   */
  @Parameter
  private File timestampFile;

  private AbstractNarMojo mojo;

  public Javah() {
  }

  public final void execute() throws MojoExecutionException, MojoFailureException {

    if (skip) {
        this.mojo.getLog().info("javah skipped");
        return;
    }

    getClassDirectory().mkdirs();

    try {
      final SourceInclusionScanner scanner = new StaleSourceScanner(this.staleMillis, getIncludes(), this.excludes);
      if (getTimestampDirectory().exists()) {
        scanner.addSourceMapping(new SingleTargetSourceMapping(".class", getTimestampFile().getPath()));
      } else {
        scanner.addSourceMapping(new SuffixMapping(".class", ".dummy"));
      }

      final Set classes = scanner.getIncludedSources(getClassDirectory(), getTimestampDirectory());

      if (!classes.isEmpty()) {
        final Set files = new HashSet();
        for (final Object aClass : classes) {
          final String file = ((File) aClass).getPath();
          final JavaClass clazz = NarUtil.getBcelClass(file);
          final Method[] method = clazz.getMethods();
          for (final Method element : method) {
            if (element.isNative()) {
              files.add(clazz.getClassName());
            }
          }
        }

        if (!files.isEmpty()) {
          getJniDirectory().mkdirs();
          getTimestampDirectory().mkdirs();

          final String javah = getJavah();

          this.mojo.getLog().info("Running " + javah + " compiler on " + files.size() + " classes...");
          final int result = NarUtil.runCommand(javah, generateArgs(files), null, null, this.mojo.getLog());
          if (result != 0) {
            throw new MojoFailureException(javah + " failed with exit code " + result + " 0x"
                + Integer.toHexString(result));
          }
          FileUtils.fileWrite(getTimestampDirectory() + "/" + getTimestampFile(), "");
        }
      }
    } catch (final InclusionScanException e) {
      throw new MojoExecutionException("JAVAH: Class scanning failed", e);
    } catch (final IOException e) {
      throw new MojoExecutionException("JAVAH: IO Exception", e);
    } catch (final ClassFormatException e) {
      throw new MojoExecutionException("JAVAH: Class could not be inspected", e);
    }
  }

  private String[] generateArgs(final Set/* <String> */classes) throws MojoExecutionException {

    final List args = new ArrayList();

    if (!this.bootClassPaths.isEmpty()) {
      args.add("-bootclasspath");
      args.add(StringUtils.join(this.bootClassPaths.iterator(), File.pathSeparator));
    }

    args.add("-classpath");
    args.add(StringUtils.join(getClassPaths().iterator(), File.pathSeparator));

    args.add("-d");
    args.add(getJniDirectory().getPath());

    if (this.mojo.getLog().isDebugEnabled()) {
      args.add("-verbose");
    }

    if (classes != null) {
      for (final Object aClass : classes) {
        args.add(aClass);
      }
    }

    if (this.extraClasses != null) {
      for (final Object extraClass : this.extraClasses) {
        args.add(extraClass);
      }
    }

    return (String[]) args.toArray(new String[args.size()]);
  }

  protected final File getClassDirectory() {
    if (this.classDirectory == null) {
      this.classDirectory = new File(this.mojo.getMavenProject().getBuild().getDirectory(), "classes");
    }
    return this.classDirectory;
  }

  protected final List getClassPaths() throws MojoExecutionException {
    if (this.classPaths.isEmpty()) {
      try {
        this.classPaths.addAll(this.mojo.getMavenProject().getCompileClasspathElements());
      } catch (final DependencyResolutionRequiredException e) {
        throw new MojoExecutionException("JAVAH, cannot get classpath", e);
      }
    }
    return this.classPaths;
  }

  protected final Set getIncludes() {
    NarUtil.removeNulls(this.includes);
    if (this.includes.isEmpty()) {
      this.includes.add("**/*.class");
    }
    return this.includes;
  }

  private String getJavah() throws MojoExecutionException, MojoFailureException {
    String javah = null;

    // try toolchain
    final Toolchain toolchain = getToolchain();
    if (toolchain != null) {
      javah = toolchain.findTool("javah");
    }

    // try java home
    if (javah == null) {
      final File javahFile = new File(this.mojo.getJavaHome(this.mojo.getAOL()), "bin");
      javah = new File(javahFile, this.name).getAbsolutePath();
    }

    // forget it...
    if (javah == null) {
      throw new MojoExecutionException("NAR: Cannot find 'javah' in Toolchain or on JavaHome");
    }

    return javah;
  }

  protected final File getJniDirectory() {
    if (this.jniDirectory == null) {
      this.jniDirectory = new File(this.mojo.getMavenProject().getBuild().getDirectory(), "nar/javah-include");
    }
    return this.jniDirectory;
  }

  protected final File getTimestampDirectory() {
    if (this.timestampDirectory == null) {
      this.timestampDirectory = getJniDirectory();
    }
    return this.timestampDirectory;
  }

  protected final File getTimestampFile() {
    if (this.timestampFile == null) {
      this.timestampFile = new File(this.name);
    }
    return this.timestampFile;
  }

  // TODO remove the part with ToolchainManager lookup once we depend on
  // 2.0.9 (have it as prerequisite). Define as regular component field then.
  private Toolchain getToolchain() {
    Toolchain toolChain = null;
    final ToolchainManager toolchainManager = ((NarJavahMojo) this.mojo).getToolchainManager();

    if (toolchainManager != null) {
      toolChain = toolchainManager.getToolchainFromBuildContext("jdk", ((NarJavahMojo) this.mojo).getSession());
    }
    return toolChain;
  }

  public final void setAbstractCompileMojo(final AbstractNarMojo abstractNarMojo) {
    this.mojo = abstractNarMojo;
  }
}


text:
package com.hurence.logisland.service.elasticsearch;

import com.hurence.logisland.annotation.documentation.CapabilityDescription;
import com.hurence.logisland.annotation.documentation.Category;
import com.hurence.logisland.annotation.documentation.ComponentCategory;
import com.hurence.logisland.annotation.documentation.Tags;
import com.hurence.logisland.annotation.lifecycle.OnDisabled;
import com.hurence.logisland.annotation.lifecycle.OnEnabled;
import com.hurence.logisland.component.InitializationException;
import com.hurence.logisland.component.PropertyDescriptor;
import com.hurence.logisland.controller.AbstractControllerService;
import com.hurence.logisland.controller.ControllerServiceInitializationContext;
import com.hurence.logisland.processor.ProcessException;
import com.hurence.logisland.service.datastore.DatastoreClientServiceException;
import com.hurence.logisland.service.datastore.MultiGetQueryRecord;
import com.hurence.logisland.service.datastore.MultiGetResponseRecord;
import com.hurence.logisland.record.Record;
import org.apache.commons.lang3.NotImplementedException;
import org.apache.commons.lang3.StringUtils;
import org.elasticsearch.action.ActionRequestValidationException;
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequestBuilder;
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesResponse;
import org.elasticsearch.action.admin.indices.create.CreateIndexRequestBuilder;
import org.elasticsearch.action.admin.indices.create.CreateIndexResponse;
import org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsAction;
import org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsResponse;
import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequestBuilder;
import org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse;
import org.elasticsearch.action.bulk.*;
import org.elasticsearch.action.get.*;
import org.elasticsearch.action.index.IndexRequest;
import org.elasticsearch.action.index.IndexRequestBuilder;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.action.search.SearchType;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.transport.TransportClient;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.transport.InetSocketTransportAddress;
import org.elasticsearch.common.unit.ByteSizeUnit;
import org.elasticsearch.common.unit.ByteSizeValue;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.SearchHit;
import org.elasticsearch.search.fetch.source.FetchSourceContext;

import java.io.File;
import java.io.IOException;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.InetSocketAddress;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.*;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;

@Category(ComponentCategory.DATASTORE)
@Tags({ "elasticsearch", "client"})
@CapabilityDescription("Implementation of ElasticsearchClientService for Elasticsearch 2.4.0.")
public class Elasticsearch_2_4_0_ClientService extends AbstractControllerService implements ElasticsearchClientService {

    protected volatile Client esClient;
    private volatile List<InetSocketAddress> esHosts;
    private volatile String authToken;
    protected volatile BulkProcessor bulkProcessor;
    protected volatile Map<String/*id*/, String/*errors*/> errors = new HashMap<>();

    @Override
    public List<PropertyDescriptor> getSupportedPropertyDescriptors() {

        List<PropertyDescriptor> props = new ArrayList<>();
        props.add(BULK_BACK_OFF_POLICY);
        props.add(BULK_THROTTLING_DELAY);
        props.add(BULK_RETRY_NUMBER);
        props.add(BATCH_SIZE);
        props.add(BULK_SIZE);
        props.add(FLUSH_INTERVAL);
        props.add(CONCURRENT_REQUESTS);
        props.add(CLUSTER_NAME);
        props.add(PING_TIMEOUT);
        props.add(SAMPLER_INTERVAL);
        props.add(USERNAME);
        props.add(PASSWORD);
        props.add(PROP_SHIELD_LOCATION);
        props.add(HOSTS);
        props.add(PROP_SSL_CONTEXT_SERVICE);
        props.add(CHARSET);

        return Collections.unmodifiableList(props);
    }

    @Override
    @OnEnabled
    public void init(ControllerServiceInitializationContext context) throws InitializationException  {
        super.init(context);
        synchronized(this) {
            try {
                createElasticsearchClient(context);
                createBulkProcessor(context);
            }catch (Exception e){
                throw new InitializationException(e);
            }
        }
    }

    /**
     * Instantiate ElasticSearch Client. This should be called by subclasses' @OnScheduled method to create a client
     * if one does not yet exist. If called when scheduled, closeClient() should be called by the subclasses' @OnStopped
     * method so the client will be destroyed when the processor is stopped.
     *
     * @param context The context for this processor
     * @throws ProcessException if an error occurs while creating an Elasticsearch client
     */
    protected void createElasticsearchClient(ControllerServiceInitializationContext context) throws ProcessException {
        if (esClient != null) {
            return;
        }

        try {
            final String clusterName = context.getPropertyValue(CLUSTER_NAME).asString();
            final String pingTimeout = context.getPropertyValue(PING_TIMEOUT).asString();
            final String samplerInterval = context.getPropertyValue(SAMPLER_INTERVAL).asString();
            final String username = context.getPropertyValue(USERNAME).asString();
            final String password = context.getPropertyValue(PASSWORD).asString();

          /*  final SSLContextService sslService =
                    context.getPropertyValue(PROP_SSL_CONTEXT_SERVICE).asControllerService(SSLContextService.class);
*/
            Settings.Builder settingsBuilder = Settings.settingsBuilder()
                    .put("cluster.name", clusterName)
                    .put("client.transport.ping_timeout", pingTimeout)
                    .put("client.transport.nodes_sampler_interval", samplerInterval);

            String shieldUrl = context.getPropertyValue(PROP_SHIELD_LOCATION).asString();
          /*  if (sslService != null) {
                settingsBuilder.setField("shield.transport.ssl", "true")
                        .setField("shield.ssl.keystore.path", sslService.getKeyStoreFile())
                        .setField("shield.ssl.keystore.password", sslService.getKeyStorePassword())
                        .setField("shield.ssl.truststore.path", sslService.getTrustStoreFile())
                        .setField("shield.ssl.truststore.password", sslService.getTrustStorePassword());
            }*/

            // Set username and password for Shield
            if (!StringUtils.isEmpty(username)) {
                StringBuffer shieldUser = new StringBuffer(username);
                if (!StringUtils.isEmpty(password)) {
                    shieldUser.append(":");
                    shieldUser.append(password);
                }
                settingsBuilder.put("shield.user", shieldUser);

            }

            TransportClient transportClient = getTransportClient(settingsBuilder, shieldUrl, username, password);

            final String hosts = context.getPropertyValue(HOSTS).asString();
            esHosts = getEsHosts(hosts);

            if (esHosts != null) {
                for (final InetSocketAddress host : esHosts) {
                    try {
                        transportClient.addTransportAddress(new InetSocketTransportAddress(host));
                    } catch (IllegalArgumentException iae) {
                        getLogger().error("Could not add transport address {}", new Object[]{host});
                    }
                }
            }
            esClient = transportClient;

        } catch (Exception e) {
            getLogger().error("Failed to create Elasticsearch client due to {}", new Object[]{e}, e);
            throw new RuntimeException(e);
        }
    }

    private TransportClient getTransportClient(Settings.Builder settingsBuilder, String shieldUrl,
                                               String username, String password)
            throws MalformedURLException {

        // Create new transport client using the Builder pattern
        TransportClient.Builder builder = TransportClient.builder();

        // See if the Elasticsearch Shield JAR location was specified, and add the plugin if so. Also create the
        // authorization token if username and password are supplied.
        final ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader();
        if (!StringUtils.isBlank(shieldUrl)) {
            ClassLoader shieldClassLoader =
                    new URLClassLoader(new URL[]{new File(shieldUrl).toURI().toURL()}, this.getClass().getClassLoader());
            Thread.currentThread().setContextClassLoader(shieldClassLoader);

            try {
                Class shieldPluginClass = Class.forName("org.elasticsearch.shield.ShieldPlugin", true, shieldClassLoader);
                builder = builder.addPlugin(shieldPluginClass);

                if (!StringUtils.isEmpty(username) && !StringUtils.isEmpty(password)) {

                    // Need a couple of classes from the Shield plugin to build the token
                    Class usernamePasswordTokenClass =
                            Class.forName("org.elasticsearch.shield.authc.support.UsernamePasswordToken", true, shieldClassLoader);

                    Class securedStringClass =
                            Class.forName("org.elasticsearch.shield.authc.support.SecuredString", true, shieldClassLoader);

                    Constructor<?> securedStringCtor = securedStringClass.getConstructor(char[].class);
                    Object securePasswordString = securedStringCtor.newInstance(password.toCharArray());

                    Method basicAuthHeaderValue = usernamePasswordTokenClass.getMethod("basicAuthHeaderValue", String.class, securedStringClass);
                    authToken = (String) basicAuthHeaderValue.invoke(null, username, securePasswordString);
                }
            } catch (ClassNotFoundException
                    | NoSuchMethodException
                    | InstantiationException
                    | IllegalAccessException
                    | InvocationTargetException shieldLoadException) {
                getLogger().debug("Did not detect Elasticsearch Shield plugin, secure connections and/or authorization will not be available");
            }
        } else {
            //logger.debug("No Shield plugin location specified, secure connections and/or authorization will not be available");
        }
        TransportClient transportClient = builder.settings(settingsBuilder.build()).build();
        Thread.currentThread().setContextClassLoader(originalClassLoader);
        return transportClient;
    }

    /**
     * Get the ElasticSearch hosts.
     *
     * @param hosts A comma-separated list of ElasticSearch hosts (host:port,host2:port2, etc.)
     * @return List of InetSocketAddresses for the ES hosts
     */
    private List<InetSocketAddress> getEsHosts(String hosts) {

        if (hosts == null) {
            return null;
        }
        final List<String> esList = Arrays.asList(hosts.split(","));
        List<InetSocketAddress> esHosts = new ArrayList<>();

        for (String item : esList) {

            String[] addresses = item.split(":");
            final String hostName = addresses[0].trim();
            final int port = Integer.parseInt(addresses[1].trim());

            esHosts.add(new InetSocketAddress(hostName, port));
        }
        return esHosts;
    }

    protected void createBulkProcessor(ControllerServiceInitializationContext context)
    {
        if (bulkProcessor != null) {
            return;
        }

        /**
         * create the bulk processor
         */
        bulkProcessor = BulkProcessor.builder(
                esClient,
                new BulkProcessor.Listener() {
                    @Override
                    public void beforeBulk(long l, BulkRequest bulkRequest) {
                        getLogger().debug("Going to execute bulk [id:{}] composed of {} actions", new Object[]{l, bulkRequest.numberOfActions()});
                    }

                    @Override
                    public void afterBulk(long l, BulkRequest bulkRequest, BulkResponse bulkResponse) {
                        getLogger().debug("Executed bulk [id:{}] composed of {} actions", new Object[]{l, bulkRequest.numberOfActions()});
                        if (bulkResponse.hasFailures()) {
                            getLogger().warn("There was failures while executing bulk [id:{}]," +
                                            " done bulk request in {} ms with failure = {}",
                                    new Object[]{l, bulkResponse.getTookInMillis(), bulkResponse.buildFailureMessage()});
                            for (BulkItemResponse item : bulkResponse.getItems()) {
                                if (item.isFailed()) {
                                    errors.put(item.getId(), item.getFailureMessage());
                                }
                            }
                        }
                    }

                    @Override
                    public void afterBulk(long l, BulkRequest bulkRequest, Throwable throwable) {
                        getLogger().error("something went wrong while bulk loading events to es : {}", new Object[]{throwable.getMessage()});
                    }

                })
                .setBulkActions(context.getPropertyValue(BATCH_SIZE).asInteger())
                .setBulkSize(new ByteSizeValue(context.getPropertyValue(BULK_SIZE).asInteger(), ByteSizeUnit.MB))
                .setFlushInterval(TimeValue.timeValueSeconds(context.getPropertyValue(FLUSH_INTERVAL).asInteger()))
                .setConcurrentRequests(context.getPropertyValue(CONCURRENT_REQUESTS).asInteger())
                .setBackoffPolicy(getBackOffPolicy(context))
                .build();
    }

    /**
     * set up BackoffPolicy
     */
    private BackoffPolicy getBackOffPolicy(ControllerServiceInitializationContext context)
    {
        BackoffPolicy backoffPolicy = BackoffPolicy.exponentialBackoff();
        if (context.getPropertyValue(BULK_BACK_OFF_POLICY).getRawValue().equals(DEFAULT_EXPONENTIAL_BACKOFF_POLICY.getValue())) {
            backoffPolicy = BackoffPolicy.exponentialBackoff();
        } else if (context.getPropertyValue(BULK_BACK_OFF_POLICY).getRawValue().equals(EXPONENTIAL_BACKOFF_POLICY.getValue())) {
            backoffPolicy = BackoffPolicy.exponentialBackoff(
                    TimeValue.timeValueMillis(context.getPropertyValue(BULK_THROTTLING_DELAY).asLong()),
                    context.getPropertyValue(BULK_RETRY_NUMBER).asInteger()
            );
        } else if (context.getPropertyValue(BULK_BACK_OFF_POLICY).getRawValue().equals(CONSTANT_BACKOFF_POLICY.getValue())) {
            backoffPolicy = BackoffPolicy.constantBackoff(
                    TimeValue.timeValueMillis(context.getPropertyValue(BULK_THROTTLING_DELAY).asLong()),
                    context.getPropertyValue(BULK_RETRY_NUMBER).asInteger()
            );
        } else if (context.getPropertyValue(BULK_BACK_OFF_POLICY).getRawValue().equals(NO_BACKOFF_POLICY.getValue())) {
            backoffPolicy = BackoffPolicy.noBackoff();
        }
        return backoffPolicy;
    }

    @Override
    public void bulkFlush() {
        bulkProcessor.flush();
    }

    @Override
    public void bulkPut(String docIndex, String docType, String document, Optional<String> OptionalId) {
        // add it to the bulk
        IndexRequestBuilder result = esClient
                .prepareIndex(docIndex, docType)
                .setSource(document)
                .setOpType(IndexRequest.OpType.INDEX);
        if(OptionalId.isPresent())
        {
            result.setId(OptionalId.get());
        }
        bulkProcessor.add(result.request());
    }

    @Override
    public void bulkPut(String docIndex, String docType, Map<String, ?> document, Optional<String> OptionalId) {
        // add it to the bulk
        IndexRequestBuilder result = esClient
                .prepareIndex(docIndex, docType)
                .setSource(document)
                .setOpType(IndexRequest.OpType.INDEX);
        if(OptionalId.isPresent())
        {
            result.setId(OptionalId.get());
        }
        bulkProcessor.add(result.request());
    }

    @Override
    public List<MultiGetResponseRecord> multiGet(List<MultiGetQueryRecord> multiGetQueryRecords){
        List<MultiGetResponseRecord> multiGetResponseRecords = new ArrayList<>();
        if (multiGetQueryRecords.isEmpty()) {
            getLogger().debug("MultiGet query called with empty list");
            return multiGetResponseRecords;
        }

        MultiGetRequestBuilder multiGetRequestBuilder = esClient.prepareMultiGet();

        for (MultiGetQueryRecord multiGetQueryRecord : multiGetQueryRecords)
        {
            String index = multiGetQueryRecord.getIndexName();
            String type = multiGetQueryRecord.getTypeName();
            List<String> documentIds = multiGetQueryRecord.getDocumentIds();
            String[] fieldsToInclude = multiGetQueryRecord.getFieldsToInclude();
            String[] fieldsToExclude = multiGetQueryRecord.getFieldsToExclude();
            if ((fieldsToInclude != null && fieldsToInclude.length > 0) || (fieldsToExclude != null && fieldsToExclude.length > 0)) {
                for (String documentId : documentIds) {
                    MultiGetRequest.Item item = new MultiGetRequest.Item(index, type, documentId);
                    item.fetchSourceContext(new FetchSourceContext(fieldsToInclude, fieldsToExclude));
                    multiGetRequestBuilder.add(item);
                    if (getLogger().isDebugEnabled()) {
                        getLogger().debug("MultiGet query adding item\n" +
                                "index : {}\n" +
                                "type : {}\n" +
                                "id : {}\n" +
                                "fields : {}\n" +
                                "excludes : {}\n" +
                                "includes : {}\n" +
                                "fetchSource : {}\n" +
                                "transformSource : {}", new Object[]{
                                item.index(),
                                item.type(),
                                item.id(),
                                item.fields(),
                                item.fetchSourceContext().excludes(),
                                item.fetchSourceContext().includes(),
                                item.fetchSourceContext().fetchSource(),
                                item.fetchSourceContext().transformSource(),
                        });
                    }
                }
            } else {
                multiGetRequestBuilder.add(index, type, documentIds);
                if (getLogger().isDebugEnabled()) {
                    getLogger().debug("MultiGet query adding item\n" +
                            "index : {}\n" +
                            "type : {}\n" +
                            "ids : {}", new Object[]{index, type, documentIds}
                    );
                }
            }
        }

        MultiGetResponse multiGetItemResponses = null;
        try {
            multiGetItemResponses = multiGetRequestBuilder.get();
        } catch (ActionRequestValidationException e) {
            getLogger().error("MultiGet query failed \n: message {}\n cause : {}", new Object[]{e.getMessage(), e.getCause()});
        }

        if (multiGetItemResponses != null) {
            for (MultiGetItemResponse itemResponse : multiGetItemResponses) {
                GetResponse response = itemResponse.getResponse();
                if (response != null && response.isExists()) {
                    Map<String,Object> responseMap = response.getSourceAsMap();
                    Map<String,String> retrievedFields = new HashMap<>();
                    responseMap.forEach((k,v) -> {if (v!=null) retrievedFields.put(k, v.toString());});
                    multiGetResponseRecords.add(new MultiGetResponseRecord(response.getIndex(), response.getType(), response.getId(), retrievedFields));
                }
            }
        }

        return multiGetResponseRecords;
    }

    @Override
    public boolean existsCollection(String indexName) throws DatastoreClientServiceException {
        // could also use  client.admin().indices().prepareExists(indexName).execute().get();
        IndicesExistsResponse ersp = IndicesExistsAction.INSTANCE.newRequestBuilder(esClient).setIndices(indexName).get();
        // TODO TK : is the following better ?
        boolean exists = esClient.admin().indices().prepareExists(indexName).execute().actionGet().isExists();
        return ersp.isExists();
    }

    @Override
    public void refreshCollection(String indexName) throws DatastoreClientServiceException {
        try {
            esClient.admin().indices().prepareRefresh(indexName).execute().get();
        }
        catch (Exception e){
            throw new DatastoreClientServiceException(e);
        }
    }

    @Override
    public void saveSync(String indexName, String doctype, Map<String, Object> doc) throws Exception {
        esClient.prepareIndex(indexName, doctype).setSource(doc).execute().get();
        refreshCollection(indexName);
    }

    @Override
    public long countCollection(String indexName) throws DatastoreClientServiceException {
        // There is no "count" method; instead make a "search for all" and set the desired number of returned
        // records to zero. No actual hits get returned, but the "metadata" for the result includes the total
        // number of matched records, ie the size.
        SearchResponse rsp;
        try {
            rsp = esClient.prepareSearch(indexName)
                    .setQuery(QueryBuilders.matchAllQuery())
                    .setSize(0)
                    .execute().get();
        }
        catch (Exception e){
            throw new DatastoreClientServiceException(e);
        }
        return rsp.getHits().getTotalHits();
    }

    @Override
    public void createCollection(String indexName, int numShards, int numReplicas) throws DatastoreClientServiceException {
        // Define the index itself
        CreateIndexRequestBuilder builder = esClient.admin().indices().prepareCreate(indexName);
        builder.setSettings(Settings.builder()
                .put("number_of_shards", numShards)
                .put("number_of_replicas", numReplicas)
                .build());

        try {
            CreateIndexResponse rsp = builder.execute().get();
            if (!rsp.isAcknowledged()) {
                throw new IOException("Elasticsearch index definition not acknowledged");
            }
            getLogger().info("Created index {}", new Object[]{indexName});
        } catch (Exception e) {
            getLogger().error("Failed to create ES index", e);
            throw new DatastoreClientServiceException("Failed to create ES index", e);
        }
    }

    @Override
    public void dropCollection(String indexName) throws DatastoreClientServiceException {
        try {
            esClient.admin().indices().prepareDelete(indexName).execute().get();
            getLogger().info("Delete index {}", new Object[]{indexName});
        } catch (Exception e) {
            throw new DatastoreClientServiceException(String.format("Unable to delete index %s", indexName), e);
        }
    }

    @Override
    public void copyCollection(String reindexScrollTimeout, String srcIndex, String dstIndex)
            throws DatastoreClientServiceException {

        SearchResponse scrollResp = esClient.prepareSearch(srcIndex)
                .setSearchType(SearchType.QUERY_AND_FETCH)
                .setScroll(reindexScrollTimeout)
                .setQuery(QueryBuilders.matchAllQuery()) // Match all query
                .setSize(100) // 100 hits per shard will be returned for each scroll
                .execute().actionGet();

        AtomicBoolean failed = new AtomicBoolean(false);

        // A user of a BulkProcessor just keeps adding requests to it, and the BulkProcessor itself decides when
        // to send a request to the ES nodes, based on its configuration settings. Calls can be triggerd by number
        // of queued requests, total size of queued requests, and time since previous request. The defaults for
        // these settings are all sensible, so are not overridden here. The BulkProcessor has an internal threadpool
        // which allows it to send multiple batches concurrently; the default is "1" meaning that a single completed
        // batch can be sending in the background while a new batch is being built. When the non-active batch is
        // "full", the add call blocks until the background batch completes.

        while (true) {
            if (scrollResp.getHits().getHits().length == 0) {
                // No more results
                break;
            }

            for (SearchHit hit : scrollResp.getHits()) {
                IndexRequest request = new IndexRequest(dstIndex, hit.type(), hit.id());
                Map<String, Object> source = hit.getSource();
                request.source(source);
                bulkProcessor.add(request);
            }

            String scrollId = scrollResp.getScrollId();
            scrollResp = esClient.prepareSearchScroll(scrollId)
                    .setScroll(reindexScrollTimeout)
                    .execute().actionGet();
        }

        getLogger().info("Reindex completed");
    }

    @Override
    public void createAlias(String indexName, String aliasName) throws DatastoreClientServiceException {
        IndicesAliasesRequestBuilder builder = esClient.admin().indices().prepareAliases().addAlias(indexName, aliasName);
        try {
            IndicesAliasesResponse rsp = builder.execute().get();
            if (!rsp.isAcknowledged()) {
                throw new DatastoreClientServiceException(String.format(
                        "Creation of elasticsearch alias '%s' for index '%s' not acknowledged.", aliasName, indexName));
            }
        } catch (DatastoreClientServiceException e) {
            getLogger().error("Failed to create elasticsearch alias {} for index {}", new Object[] {aliasName, indexName, e});
            throw e;
        } catch (ExecutionException | InterruptedException e) {
            String msg = String.format("Failed to create elasticsearch alias '%s' for index '%s'", aliasName, indexName);
            throw new DatastoreClientServiceException(e);
        }
    }

    @Override
    public boolean putMapping(String indexName, String doctype, String mappingAsJsonString)
            throws DatastoreClientServiceException {

        PutMappingRequestBuilder builder = esClient.admin().indices().preparePutMapping(indexName);
        builder.setType(doctype).setSource(mappingAsJsonString);

        try {
            PutMappingResponse rsp = builder.execute().get();
            if (!rsp.isAcknowledged()) {
                throw new DatastoreClientServiceException("Elasticsearch mapping definition not acknowledged");
            }
            return true;
        } catch (Exception e) {
            getLogger().error("Failed to load ES mapping {} for index {}", new Object[]{doctype, indexName, e});
            // This is an error that can be fixed by providing alternative inputs so return boolean rather
            // than throwing an exception.
            return false;
        }
    }

    @Override
    public void bulkPut(String indexTypeName, Record record) throws DatastoreClientServiceException {
        final List<String> indexType = Arrays.asList(indexTypeName.split(","));

        if (indexType.size() == 2) {
            String indexName = indexType.get(0);
            String typeName = indexType.get(1);
            this.bulkPut(indexName, typeName, ElasticsearchRecordConverter.convertToString(record), Optional.of(record.getId()));
        }
        else {
            throw new DatastoreClientServiceException("The Elastic Search type name is missing. Please add at least default.type to the processor parameters");
        }
    }

    @Override
    public void put(String collectionName, Record record, boolean asynchronous) throws DatastoreClientServiceException {
        throw new NotImplementedException("Not yet supported for ElasticSearch 2.4.0");
    }

    @Override
    public void remove(String collectionName, Record record, boolean asynchronous) throws DatastoreClientServiceException {
        throw new NotImplementedException("Not yet supported for ElasticSearch 2.4.0");
    }

    @Override
    public Record get(String collectionName, Record record) throws DatastoreClientServiceException {
        throw new NotImplementedException("Not yet supported for ElasticSearch 2.4.0");
    }

    @Override
    public Collection<Record> query(String query) {
        throw new NotImplementedException("Not yet supported for ElasticSearch 2.4.0");
    }

    @Override
    public long queryCount(String query) {
        throw new NotImplementedException("Not yet supported for ElasticSearch 2.4.0");
    }

    @Override
    public String convertRecordToString(Record record) {
        return ElasticsearchRecordConverter.convertToString(record);
    }

    @Override
    public long searchNumberOfHits(String docIndex, String docType, String docName, String docValue)
    {
        SearchResponse searchResponse = esClient.prepareSearch(docIndex)
                .setTypes(docType)
                .setSearchType(SearchType.DFS_QUERY_THEN_FETCH)
                .setQuery(QueryBuilders.termQuery(docName, docValue))
                .setFrom(0).setSize(60).setExplain(true)
                .execute()
                .actionGet();

        long numberOfHits = searchResponse.getHits().getTotalHits();

        return numberOfHits;
    }

    @OnDisabled
    public void shutdown() {
        if (bulkProcessor != null) {
            bulkProcessor.flush();
            try {
                if (!bulkProcessor.awaitClose(10, TimeUnit.SECONDS)) {
                    getLogger().error("some request could not be send to es because of time out");
                } else {
                    getLogger().info("all requests have been submitted to es");
                }
            } catch (InterruptedException e) {
                getLogger().error(e.getMessage());
            }
        }

        if (esClient != null) {
            getLogger().info("Closing ElasticSearch Client");
            esClient.close();
            esClient = null;
        }
    }

}


text:
FROM ubuntu:latest

RUN apt-get update && \
  DEBIAN_FRONTEND=noninteractive apt-get install -yq libpython2.7-dev python-pip && \
  apt-get clean && \
  rm -rf /var/lib/apt/lists/* && \
  pip install asyncoro psutil netifaces

CMD ["/usr/local/bin/discoronode.py"]


text:
class StringIterator {
    [Symbol.iterator]() {
        return this;
    }
}

var v: string;
for (v of new StringIterator) { } // Should fail

for (v of new StringIterator) { } // Should still fail (related errors should still be shown even though type is cached).

//// [for-of16.js]
class StringIterator {
    [Symbol.iterator]() {
        return this;
    }
}
var v;
for (v of new StringIterator) { } // Should fail
for (v of new StringIterator) { } // Should still fail (related errors should still be shown even though type is cached).


text:
const Node = require('./resources/node');
const Query = require('./resources/entityQuery');
const Menu = require('./resources/menu');
const ContentType = require('./resources/contentType');

module.exports = class Hydrant {
  /**
   * Create an instance of the Hydrant class.
   * @param {string} base
   *   The base path of the Drupal site.
   * @param {object} credentials
   *   The credentials object.
   */
  constructor(base, credentials) {
    this.api = {
      node: new Node(base, credentials),
      menu: new Menu(base, credentials),
      contentType: new ContentType(base, credentials),
      query: entityType => new Query(base, credentials, entityType)
    };
  }

};


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

import com.intellij.openapi.util.Pair;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.awt.*;

/**
 * @author Konstantin Bulenkov
 */
public interface DnDSource extends DnDDropActionHandler {
  boolean canStartDragging(DnDAction action, Point dragOrigin);

  DnDDragStartBean startDragging(DnDAction action, Point dragOrigin);

  /**
   * Image to be drawn on screen while dragging and the point of the offset to position cursor
   * in the proper place
   *
   * @param action drag-n-drop action
   * @param dragOrigin origin drag point
   * @param bean a bean to create an image for
   * @return Pair of image and cursor offset at the image
   */
  @Nullable
  default Pair<Image, Point> createDraggedImage(DnDAction action, Point dragOrigin, @NotNull DnDDragStartBean bean) {
    return createDraggedImage(action, dragOrigin);
  }

  /**
   * @deprecated override {@link DnDSource#createDraggedImage(DnDAction, Point, DnDDragStartBean)} instead
   */
  @Deprecated
  @ApiStatus.ScheduledForRemoval(inVersion = "2021.3")
  @Nullable
  default Pair<Image, Point> createDraggedImage(DnDAction action, Point dragOrigin) {
    return null;
  }

  default void dragDropEnd() {
  }

  @Override
  default void dropActionChanged(int gestureModifiers) {
  }
}


text:
PORTNUM=$1
if [[ "${PORTNUM}" == "" ]]; then
    PORTNUM="8000"
fi;

echo "***Will listen on port ${PORTNUM}***"

this=${BASH_SOURCE[0]}
here=`dirname ${this}`
activate="${here}/env/bin/activate"
echo "Activating ${activate}"
source ${activate}
echo "Activated"

pushd vocab
python3 flask_vocab.py -P ${PORTNUM} &
pid=$!
popd
echo "${pid}" >SERVICE_PID
echo "***"
echo "Flask server started"
echo "PID ${pid} listening on port ${PORTNUM}"
echo "SERVICE_PID: " `cat SERVICE_PID`
echo "***"

#
#
# Design notes:
# This is a shell script outside the Makefile so that we
# can make sure it is run by bash, with one shell process
# running the whole script.  Make uses a separate shell
# process for each line of a recipe, making it difficult to
# capture the process ID.  Also Make can use a different
# shell, and may act differently between Windows and Unix.
#
# see also: stop.sh


text:
struct udev_device;

namespace device {

// This class listends for notifications from libudev about
// connected/disconnected devices. This class is *NOT* thread-safe.
class DEVICE_BASE_EXPORT DeviceMonitorLinux {
 public:
  typedef base::RepeatingCallback<void(udev_device* device)> EnumerateCallback;

  class Observer {
   public:
    virtual ~Observer() {}
    virtual void OnDeviceAdded(udev_device* device) = 0;
    virtual void OnDeviceRemoved(udev_device* device) = 0;
  };

  DeviceMonitorLinux();

  DeviceMonitorLinux(const DeviceMonitorLinux&) = delete;
  DeviceMonitorLinux& operator=(const DeviceMonitorLinux&) = delete;

  static DeviceMonitorLinux* GetInstance();

  void AddObserver(Observer* observer);
  void RemoveObserver(Observer* observer);

  void Enumerate(const EnumerateCallback& callback);

 private:
  friend std::default_delete<DeviceMonitorLinux>;

  ~DeviceMonitorLinux();

  void OnMonitorCanReadWithoutBlocking();

  ScopedUdevPtr udev_;
  ScopedUdevMonitorPtr monitor_;
  int monitor_fd_;
  std::unique_ptr<base::FileDescriptorWatcher::Controller>
      monitor_watch_controller_;

  base::ObserverList<Observer, true>::Unchecked observers_;

  base::ThreadChecker thread_checker_;
};

}  // namespace device

#endif  // DEVICE_BASE_DEVICE_MONITOR_LINUX_H_


text:
#include "cleanup.h"
#include "res_path.h"
#include "drawing_functions.h"
#include "SDL_mixer.h"
#include "globals.h"
#include "game.h"
#include <cstdlib>
#include <ctime>

int main(int argc, char **argv) {
	// set the random seed for the random number sequence
	srand(time(0));

	// setup SDL
	if (SDL_Init(SDL_INIT_EVERYTHING) != 0) {
		cout << "error initializing SDL" << endl;
		return 1;
	}

	// setup window
	SDL_Window *window = SDL_CreateWindow("Cyborg Battle", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, Globals::ScreenWidth*Globals::ScreenScale, Globals::ScreenHeight*Globals::ScreenScale, SDL_WINDOW_SHOWN);
	if (window == nullptr) {
		SDL_Quit();
		cout << "window error" << endl;
		return 1;
	}

	// setup renderer
	Globals::renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
	if (Globals::renderer == nullptr) {
		cleanup(window);
		SDL_Quit();
		cout << "renderer error" << endl;
		return 1;
	}

	// This is the size to draw things at, before we scale it to the screen size dimensions mentionned in createwindow
	SDL_RenderSetLogicalSize(Globals::renderer, Globals::ScreenWidth, Globals::ScreenHeight);

	// initialize sdl_image
	if ((IMG_Init(IMG_INIT_PNG) & IMG_INIT_PNG) != IMG_INIT_PNG) {
		SDL_Quit();
		cout << "sdl image did not initialize" << endl;
		return 1;
	}

	//Initialize the text font
	if (TTF_Init() != 0) {
		SDL_Quit();
		cout << "sdl ttf did not initialize" << endl;
		return 1;
	}

	// initialize sdl mixer
	if (Mix_OpenAudio(22050, MIX_DEFAULT_FORMAT, 2, 4096) == -1) {
		SDL_Quit();
		cout << "mixer did not initialize" << endl;
		return 1;
	}

	// load up a texture to drawn
	/*string resPath = getResourcePath();
	SDL_Texture *texture = loadTexture(resPath + "map.png", Globals::renderer);

	// run game for 5000 ticks (5000ms)
	while (SDL_GetTicks() < 5000) {
		// clear the screen
		SDL_RenderClear(Globals::renderer);
		// draw what we want to the screen
		renderTexture(texture, Globals::renderer, 0, 0);
		// show image we've been rendering
		SDL_RenderPresent(Globals::renderer);
	}*/

	Game game;
	game.update();

	cleanup(Globals::renderer);
	cleanup(window);
	//cleanup(texture);

	SDL_Quit();
	return 0;
}


text: The `config-aggregator` module for OAE.


text:
 1">

Page

  <ul class="Pagination-list cf" ng-if="1 < pages.length">

      |‹ First

      ‹ Prev

      {{ pageNumber }}

      Next ›

      Last ›|


text:
package com.flying.xiao;

import java.util.ArrayList;
import java.util.List;

import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.provider.Contacts.Intents.UI;
import android.view.KeyEvent;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.AbsListView;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.TextView;

import com.flying.xiao.adapter.ListViewCommunityAdapter;
import com.flying.xiao.adapter.ListViewMainContentAdapter;
import com.flying.xiao.app.AppException;
import com.flying.xiao.common.StringUtils;
import com.flying.xiao.common.UIHelper;
import com.flying.xiao.constant.Constant;
import com.flying.xiao.control.NetControl;
import com.flying.xiao.entity.XContent;
import com.flying.xiao.entity.XUserInfo;

/**
 * ËÑË÷
 */
public class SearchActivity extends BaseActivity{
	private Button mSearchBtn;
	private EditText mSearchEditer;
	private ProgressBar mProgressbar;

	private Button search_catalog_lost;
	private Button search_catalog_market;
	private Button search_catalog_user;
	private Button search_catalog_ask;
	private Button search_catalog_news;

	private ListView mlvSearch;
	private List lvSearchContentData = new ArrayList();
	private List lvSearchUserData = new ArrayList();
	private View lvSearch_footer;
	private TextView lvSearch_foot_more;
	private ProgressBar lvSearch_foot_progress;
    private int lvSumData;
    private ListViewMainContentAdapter mContentAdapter;
    private ListViewMainContentAdapter mMarketAdapter;
    private ListViewCommunityAdapter mUserAdapter ;
	private int curLvDataState;
	private String curSearchContent = "";

	private InputMethodManager imm;
	private int type=1;
	private final static int DATA_LOAD_ING = 0x001;
	private final static int DATA_LOAD_COMPLETE = 0x002;

	@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_search);

        this.initView();

        this.initData();
	}

    /**
     * Í·²¿°´Å¥Õ¹Ê¾
     * @param type
     */
    private void headButtonSwitch(int type) {
    	switch (type) {
    	case DATA_LOAD_ING:
    		mSearchBtn.setClickable(false);
			mProgressbar.setVisibility(View.VISIBLE);
			break;
		case DATA_LOAD_COMPLETE:
			mSearchBtn.setClickable(true);
			mProgressbar.setVisibility(View.GONE);
			break;
		}
    }

	//³õ'»¯ÊÓͼ¿Ø¼þ
    private void initView()
    {
    	imm = (InputMethodManager)getSystemService(INPUT_METHOD_SERVICE);

    	mSearchBtn = (Button)findViewById(R.id.search_btn);
    	mSearchEditer = (EditText)findViewById(R.id.search_editer);
    	mProgressbar = (ProgressBar)findViewById(R.id.search_progress);

    	mSearchBtn.setOnClickListener(new View.OnClickListener() {
			public void onClick(View view) {
				mSearchEditer.clearFocus();
				curSearchContent = mSearchEditer.getText().toString();
				loadLvSearchData(type,0,mHandler, UIHelper.LISTVIEW_ACTION_INIT);
//				loadLvSearchData(curSearchCatalog, 0, mSearchHandler, UIHelper.LISTVIEW_ACTION_INIT);
			}
		});
    	mSearchEditer.setOnFocusChangeListener(new View.OnFocusChangeListener() {
			public void onFocusChange(View v, boolean hasFocus) {
				if(hasFocus){
					imm.showSoftInput(v, 0);
		        }
		        else{
		            imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
		        }
			}
		});
    	mSearchEditer.setOnKeyListener(new View.OnKeyListener() {
			public boolean onKey(View v, int keyCode, KeyEvent event) {
				if (keyCode == KeyEvent.KEYCODE_ENTER || keyCode == KeyEvent.KEYCODE_SEARCH) {
					if(v.getTag() == null) {
						v.setTag(1);
						mSearchEditer.clearFocus();
						curSearchContent = mSearchEditer.getText().toString();
						loadLvSearchData(type,0,mHandler, UIHelper.LISTVIEW_ACTION_INIT);
//						loadLvSearchData(curSearchCatalog, 0, mSearchHandler, UIHelper.LISTVIEW_ACTION_INIT);
					}else{
						v.setTag(null);
					}
					return true;
				}
				return false;
			}
		});

    	search_catalog_lost = (Button)findViewById(R.id.search_catalog_lost);
    	search_catalog_market = (Button)findViewById(R.id.search_catalog_market);
    	search_catalog_user = (Button)findViewById(R.id.search_catalog_user);
    	search_catalog_ask = (Button)findViewById(R.id.search_catalog_ask);
    	search_catalog_news = (Button)findViewById(R.id.search_catalog_news);

    	search_catalog_lost.setOnClickListener(this.searchBtnClick(search_catalog_lost,Constant.ContentType.CONTENT_TYPE_LOST));
    	search_catalog_market.setOnClickListener(this.searchBtnClick(search_catalog_market,Constant.ContentType.CONTENT_TYPE_MARKET));
    	search_catalog_user.setOnClickListener(this.searchBtnClick(search_catalog_user,-1));
    	search_catalog_ask.setOnClickListener(this.searchBtnClick(search_catalog_ask,Constant.ContentType.CONTENT_TYPE_ASK));
    	search_catalog_news.setOnClickListener(this.searchBtnClick(search_catalog_news,Constant.ContentType.CONTENT_TYPE_NEWS));

    	search_catalog_news.setEnabled(false);

    	lvSearch_footer = getLayoutInflater().inflate(R.layout.listview_footer, null);
    	lvSearch_foot_more = (TextView)lvSearch_footer.findViewById(R.id.listview_foot_more);
    	lvSearch_foot_progress = (ProgressBar)lvSearch_footer.findViewById(R.id.listview_foot_progress);
    	mContentAdapter=new ListViewMainContentAdapter(this, lvSearchContentData, R.layout.main_fragment_news_listitem);
    	mMarketAdapter=new ListViewMainContentAdapter(this, lvSearchContentData, R.layout.main_fragment_market_listitem,true);
    	mUserAdapter=new ListViewCommunityAdapter(this, lvSearchUserData, R.layout.community_fragment_listitem);
    	mlvSearch = (ListView)findViewById(R.id.search_listview);
    	mlvSearch.setVisibility(ListView.GONE);
    	mlvSearch.addFooterView(lvSearch_footer);//Ìí¼Óµ×²¿ÊÓͼ  ±ØÐëÔÚsetAdapterÇ°
    	mlvSearch.setAdapter(mContentAdapter);
    	mlvSearch.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        	public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
        		//µã»÷µ×²¿À¸ÎÞЧ
        		if(view == lvSearch_footer) return;

        		if(type==-1){
        			UIHelper.showUserInfo(SearchActivity.this, (XUserInfo)lvSearchUserData.get(position));
        		}else{
        			UIHelper.showContentInfo(SearchActivity.this, (XContent)lvSearchContentData.get(position), type);
        		}
        	}
		});
    	mlvSearch.setOnScrollListener(new AbsListView.OnScrollListener() {
			public void onScrollStateChanged(AbsListView view, int scrollState) {
				//Êý¾ÝΪ¿Õ--²»ÓüÌÐøÏÂÃæ´úÂëÁË
				if(lvSearchContentData.size() == 0) return;

				//ÅжÏÊÇ·ñ¹ö¶¯µ½µ×²¿
				boolean scrollEnd = false;
				try {
					if(view.getPositionForView(lvSearch_footer) == view.getLastVisiblePosition())
						scrollEnd = true;
				} catch (Exception e) {
					scrollEnd = false;
				}

				if(scrollEnd && curLvDataState==1)
				{
					mlvSearch.setTag(1);
					lvSearch_foot_more.setText(R.string.load_ing);
					lvSearch_foot_progress.setVisibility(View.VISIBLE);
					//µ±Ç°pageIndex
					int pageIndex = lvSumData/20;
					loadLvSearchData(type,pageIndex,mHandler, UIHelper.LISTVIEW_ACTION_SCROLL);
//					loadLvSearchData(curSearchCatalog, pageIndex, mSearchHandler, UIHelper.LISTVIEW_ACTION_SCROLL);
				}
			}
			public void onScroll(AbsListView view, int firstVisibleItem,int visibleItemCount, int totalItemCount) {
			}
		});
    }

    //³õ'»¯¿Ø¼þÊý¾Ý
  	private void initData()
  	{
		mHandler = new Handler()
		{
			public void handleMessage(Message msg) {

				headButtonSwitch(DATA_LOAD_COMPLETE);

				if(msg.what >= 0){
					List list = (List) msg.obj;
					//´¦ÀílistviewÊý¾Ý
					switch (msg.arg1) {
					case UIHelper.LISTVIEW_ACTION_INIT:
					case UIHelper.LISTVIEW_ACTION_REFRESH:
					case UIHelper.LISTVIEW_ACTION_CHANGE_CATALOG:
						lvSumData = msg.what;
						if(msg.arg2==-1)
						{
							lvSearchUserData.clear();
							lvSearchUserData.addAll(list);
						}else
						{
							lvSearchContentData.clear();//ÏÈÇå³ýÔÓÐÊý¾Ý
							lvSearchContentData.addAll(list);
						}
						break;
					case UIHelper.LISTVIEW_ACTION_SCROLL:
						lvSumData += msg.what;
						if(msg.arg2==-1){
							lvSearchUserData.addAll(list);
						}else{
							lvSearchContentData.addAll(list);
						}

						break;
					}

					if(msg.what < 20){
						curLvDataState = UIHelper.LISTVIEW_DATA_FULL;
						notifyDataSetChanged(msg.arg2);
						lvSearch_foot_more.setText(R.string.load_full);
					}else if(msg.what == 20){
						curLvDataState = UIHelper.LISTVIEW_DATA_MORE;
						notifyDataSetChanged(msg.arg2);
						lvSearch_foot_more.setText(R.string.load_more);
					}
				}
				else if(msg.what == -1){
					//ÓÐÒì³£--ÏÔʾ¼ÓÔسö´í & µ¯³ö´íÎóÏûÏ¢
					curLvDataState = UIHelper.LISTVIEW_DATA_MORE;
					lvSearch_foot_more.setText(R.string.load_error);
					((AppException)msg.obj).makeToast(SearchActivity.this);
				}
				if(lvSearchContentData.size()==0){
					curLvDataState = UIHelper.LISTVIEW_DATA_EMPTY;
					lvSearch_foot_more.setText(R.string.load_empty);
				}
				lvSearch_foot_progress.setVisibility(View.GONE);
				if(msg.arg1 != UIHelper.LISTVIEW_ACTION_SCROLL){
					mlvSearch.setSelection(0);//·µ»ØÍ·²¿
				}
			}
		};
  	}

  	private void notifyDataSetChanged(int type){
  		if(type==-1){
  			mUserAdapter.notifyDataSetChanged();
  		}else if(type==Constant.ContentType.CONTENT_TYPE_MARKET){
  			mContentAdapter.notifyDataSetChanged();
  		}else{
  			mMarketAdapter.notifyDataSetChanged();
  		}
  	}

    /**
     * ²éÕÒ
     * @param type -1Óû§
     * @param pageIndex µ±Ç°Ò³Êý
     * @param handler ´¦ÀíÆ÷
     * @param action ¶¯×÷±êʶ
     */
	private void loadLvSearchData(final int type,final int pageIndex,final Handler handler,int action){
		if(StringUtils.isEmpty(curSearchContent)){
			UIHelper.ToastMessage(SearchActivity.this, "ÇëÊäÈëËÑË÷ÄÚÈÝ");
			return;
		}

		headButtonSwitch(DATA_LOAD_ING);
		mlvSearch.setVisibility(ListView.VISIBLE);
		NetControl.getShare(this).loadLvSearchData(curSearchContent,type, pageIndex, handler, action);
	}

	private View.OnClickListener searchBtnClick(final Button btn,final int type){
    	return new View.OnClickListener() {
			public void onClick(View v) {
		    	if(btn == search_catalog_ask)
		    		search_catalog_ask.setEnabled(false);
		    	else
		    		search_catalog_ask.setEnabled(true);
		    	if(btn == search_catalog_user)
		    		search_catalog_user.setEnabled(false);
		    	else
		    		search_catalog_user.setEnabled(true);
		    	if(btn == search_catalog_news)
		    		search_catalog_news.setEnabled(false);
		    	else
		    		search_catalog_news.setEnabled(true);
		    	if(btn == search_catalog_market)
		    		search_catalog_market.setEnabled(false);
		    	else
		    		search_catalog_market.setEnabled(true);
		    	if(btn == search_catalog_lost)
		    		search_catalog_lost.setEnabled(false);
		    	else
		    		search_catalog_lost.setEnabled(true);

				//¿ªÊ¼ËÑË÷
				mSearchEditer.clearFocus();
				curSearchContent = mSearchEditer.getText().toString();
				SearchActivity.this.type=type;
				lvSearchUserData.clear();
				lvSearchContentData.clear();
				if(type==Constant.ContentType.CONTENT_TYPE_MARKET){
					mlvSearch.setAdapter(mMarketAdapter);
				}else if(type==-1){
					mlvSearch.setAdapter(mUserAdapter);
				}else{
					mlvSearch.setAdapter(mContentAdapter);
				}
				loadLvSearchData(type,0,mHandler, UIHelper.LISTVIEW_ACTION_CHANGE_CATALOG);
//				loadLvSearchData(catalog, 0, mSearchHandler, UIHelper.LISTVIEW_ACTION_CHANGE_CATALOG);
			}
		};
    }
}


text:
[![Build Status](https://travis-ci.org/ngTrumbitta/ngtrumbitta-services-lodash.svg?branch=master)](https://travis-ci.org/ngTrumbitta/ngtrumbitta-services-lodash)

Inject Lodash in any Angular application, and use it via the good old `_` handler.

Just a little something I find myself rewriting every time I work on an Angular application.
Well, no more I guess ;)

## Install

```sh
bower install ngtrumbitta-services-lodash
```

## Use

```html
<script src="//code.angularjs.org/1.4.5/angular.min.js"></script>
<script src="bower_components/lodash/lodash.min.js"></script>
<script src="bowser_components/ngtrumbitta-services-lodash/src/lodash.service.js"></script>
```

```javascript
angular.module('app.services.myservice', [
  'ngtrumbitta.services.lodash'
  ])
  .service('myService', function(_) {

    this.getMyGirls = function() {
      var myCollection = ['Buffy', 'Xander', 'Willow', 'Giles'];
      var myGirls = ['Buffy', 'Willow'];
      return _.at(myCollection, [0, 2]);
    };

  });

```

## License

MIT – See [license file](LICENSE)