text:
% :- if(( ( \+ ((current_prolog_flag(logicmoo_include,Call),Call))) )).
% :- swi_module(mud_simple_decl_parser, [parserVars/3,parserVars/4,asserta_parserVars/3]).
/* * <module> simple_decl_parser - an example of simple parsing of an inform7 like languages.
%
% Logicmoo Project PrologMUD: A MUD server written in Prolog
% Maintainer: Douglas Miles
% Dec 13, 2035
%
*/
% :- endif.

:- check_clause_counts.
:- include(prologmud(mud_header)).
:- use_module(library(pfc)).
:- check_clause_counts.

:-discontiguous((translation_spo/6,parserTest/2,parserTest/3,translation_w//
                                                                              1)).
:-dynamic((translation_spo/6,parserTest/2,parserTest/3,translation_w//
                                                                         1)).
:-thread_local(loosePass/0).
:-thread_local(debugPass/0).
:-dynamic(parserVars/4).

glue_words(W):- member(W,[is,a,the,in,carries,'An','A','The',was,of,type]).

toCamelAtom(List,O):-((\+((member(IS,List),glue_words(IS))),toCamelAtom00(List,O))),!.

% toCamelAtom00(I,O):-toCamelAtom0(I,O).
toCamelAtom00(I,O):-toCamelcase(I,O).

 % :- set_prolog_flag(subclause_expansion,true).

vtColor(vRed).

ttValueType(vtColor).

'==>'((isa(X,ttValueType)/(X\==vtValue)),
  (genls(X,vtValue),completelyAssertedCollection(X))).

completelyAssertedCollection(vtValue).

isa(vtValue,ttValueType).

typeGenls(ttValueType,vtValue).

:-must(vtColor(vRed)).
:-must((isa(vRed,REDISA),genls(REDISA,vtValue))).

 % :- set_prolog_flag(subclause_expansion,false).

:- baseKB:ensure_loaded(library(multimodal_dcg)).

asserta_parserVars(N,V,Type):- show_failure(current_agent(A)),asserta(parserVars(A,N,V,Type)).
:-export(parserVars/3).
parserVars(N,V,Type):- show_failure(current_agent(A);A=iCurrentAgentFn),
   (parserVars_local(A,N,V,Type)*->true;parserVars_falback(global,N,V,Type)).

parserVars_local(A,(N1;N2),V,Type):-!,parserVars_local(A,N1,V,Type);parserVars_local(A,N2,V,Type).
parserVars_local(A,N,V,Type):-parserVars(A,N,V,Type).

parserVars_falback(_,N,V,Type):-parserVars_local(global,N,V,Type).

toCol(Txt,I,TCOL):-member(TCOL,[tCol,tObj,tSpatialThing,vtValue,ttTypeType]),show_success(toCol_0,toCol_0(Txt,I,TCOL)),!.

toCol_0(Txt,O,TCOL):-member(Pfx-Sfx- _ISACISA,
         [
          ''-''-_,
          't'-''-'tCol',
          'tt'-'Type'-'ttTypeType',
          'vt'-''-'ttValueTypeType',
          'v'-''-'vtValue',
          'i'-'7'-'tSpatialThing',
          'i'-'7'-'ttSpatialType',
          't'-'Able'-'ttTypeByAction',
          'tt'-''-'ttTypeType',
          ''-''-_
           ]),atom_concat(Pfx,Txt,I),atom_concat(I,Sfx,O),isa(O,TCOL),!.

is_a --> is_was, [a].
is_a --> is_was.

is_was --> [is].
is_was --> [was].
is_was --> [be].
is_was --> [are].

is_in --> is_was, [in].
is_in --> is_was, [inside,of].
is_in --> is_was, [carried,by].

is_type_of --> is_a, [type,of].
is_type_of --> is_a, [type].

detn(exists) --> [the].
detn(exists) --> ['The'].
detn(exists) --> [some].
detn(all) --> [all].
detn(indef) --> [a].
detn(indef) --> ['A'].
detn(indef) --> [an].
detn(indef) --> ['An'].

collection(I,Col,More)--> detn(_),!,collection(I,Col,More).
collection(I,Col,true)--> collection0(I,Col).
collection(I,Col,More)--> attribute(_Pred,I,_Value,More),collection0(I,Col).
collection(I,Col,More)--> attribute(_Pred,I,_Value,More),{call_u(isa(I,Col))}.

collection0(I,Col)--> [A,B,C],{toCamelAtom([A,B,C],O),collection00(O,I,Col)}.
collection0(I,Col)--> [A,B],{toCamelAtom([A,B],O),collection00(O,I,Col)}.
collection0(I,Col)--> [O],{collection00(O,I,Col)}.

collection00(A,I,Col):-mudKeyword(I,W),string_equal_ci(A,W),toCol(A,I,Col).
collection00(M,I,Col):-toCol(M,I,Col).
collection00(A,I,Col):-toPropercase(A,O),toCol(O,I,Col).

subject(I,More)-->subject(I,_,More).
subject(I,T,true)-->(['This'];['this']),!,{must((parserVars(isThis,I,T);parserVars(_,I,T)))}.
subject(I,T,true)--> [IT],{string_equal_ci(IT,ITLC),parserVars(isParserVar(ITLC),I,T)},!.
subject(I,T,true)--> [IT],{string_equal_ci(IT,ITLC),parserVars((ITLC),I,T)},!.
subject(I,T,More)--> dcgOptional(detn(_)),collection(I,T,More),{(asserta_parserVars(isThis,I,T))}.

object(I,More)-->object(I,_,More).
object(I,T,true)-->([it];['It'];['This'];['this']),!,{must((parserVars(object,I,T);parserVars(_,I,T)))}.
object(I,T,More)--> detn(_),!,collection(I,T,More),{(asserta_parserVars(object,I,T))}.
object(I,T,More)--> collection(I,T,More),{(asserta_parserVars(object,I,T))}.

% big , red , flat, etc
attribute(Pred,I,C,t(Pred,I,C))--> [W],{ \+ glue_words(W),collection00(W,C,vtValue), isa(C,What),\=(What,vtValue),isa(What,ttValueType),argIsa(Pred,2,What)}.

dcgParse213(A1,A2,A3,S,E):-append([L|Left],[MidT|RightT],S),phrase(A2,[MidT|RightT],EE),     ((phrase(A1,[L|Left],[]),phrase(A3,EE,E))).
dcgParse213(A1,A2,A3,S,E):-debugPass,append([L|Left],[MidT|RightT],S),phrase(A2,[MidT|RightT],EE), trace, must((phrase(A1,[L|Left],[]),phrase(A3,EE,E))).

p_predicate(Pred,_Arg1Isa,_Arg2Isa)-->predicate0(Pred),{current_predicate(Pred/_),!}.
p_predicate(Pred,_Arg1Isa,_Arg2Isa)-->{loosePass},predicate0(Pred).

predicate0(mudStowing)-->[carries].
predicate0(mudWielding)-->[wields].
predicate0(mudLikes)-->[likes].
predicate0(mudColor)-->[is,colored].
predicate0(localityOfObject)-->is_in.
predicate0(Pred)-->[has,Color],{i_name(mud,Color,Pred)}.
predicate0(isa)-->is_type_of.
predicate0(Pred)-->[is,the,Color],{i_name(mud,Color,Pred)}.
predicate0(Pred)-->[Likes],{atom_concat(Like,'s',Likes),i_name(mud,Like,Pred)}.
predicate0(Pred)-->[is,Colored],{atom_concat(Color,'ed',Colored),i_name(mud,Color,Pred)}.
predicate0(isa)-->is_a.
predicate0(mudRelates)-->is_was.
predicate0(isa)-->[is].

 % :- set_prolog_flag(subclause_expansion,true).

tCol('tRoom').

% :-ignore(show_call(phrase(collection(I,T,More),[red,room]))).

%TODO "All couches are things."

% assert_text(iWorld7,"couches are hard sometimes").

parserTest(A,B):-parserTest(A,B,_).

:-assertz_if_new(parserTest(iWorld7,"A television is usually in the living room.")).

% :-assert_text_now(iWorld7,"You are in a well kept garden.").

translation_spo(Prolog,localityOfObject,I,C) --> dcgParse213(subject(I,More1),is_in,object(C,More2)),{conjoin(More1,More2,Prolog)}.

% :-assertz_if_new(parserTest(iKitchen7,"This is the red room.")).

:-assertz_if_new(parserTest(iWorld7,"The player carries the sack.")).
translation_spo(Prolog,Pred,I,C) --> dcgParse213(subject(I,Arg1Isa,More1),p_predicate(Pred,Arg1Isa,Arg2Isa),object(C,Arg2Isa,More2)),{conjoin(More1,More2,Prolog)}.

:-assertz_if_new(parserTest(iWorld7,"room is type of tRegion")).
translation_spo(Prolog,isa,I,C) --> dcgParse213(subject(I,tCol,More1),is_type_of,object(C,tCol,More2)),{conjoin(More1,More2,Prolog)}.

:-assertz_if_new(parserTest(iWorld7,"The Living room is a room.")).
tCol('tSack').

:-assertz_if_new(parserTest(iWorld7,"The sack is a container.")).
translation_spo(Prolog,isa,I,C) --> dcgParse213(subject(I,More1),is_a,object(C,tCol,More2)),{conjoin(More1,More2,Prolog)}.

:-assert_if_new(vtSize('vBulky')).

translation_spo(Prolog,isa,I,C) --> dcgParse213(subject(I,More1),is_was,object(C,_,More2)),{conjoin(More1,More2,Prolog)}.
translation_spo(Prolog,Pred,I,C) --> dcgParse213(subject(I,More1),is_was,attribute(Pred,I,C,More2)),{conjoin(More1,More2,Prolog)}.

%:-assertz_if_new(parserTest(iWorld7,"A coffee table is in the living room.")).
%:-assertz_if_new(parserTest(iWorld7,"It is bulky.")).

tCol('tRemoteControl').
:-assertz_if_new(parserTest(iWorld7,"A remote control is in the living room.")).
:-assertz_if_new(parserTest(iWorld7,"A tv guide is a type of item.")).

tCol('tTvGuide').
:-assertz_if_new(parserTest(iWorld7,"A tv guide is in the living room.")).

%:-assertz_if_new(parserTest(iWorld7,"The paper clip is on the coffee table.")).

:-assertz_if_new(parserTest(iWorld7,"A tv guide is a type of book.")).

toplevel_type(InstISA):-member(InstISA,[tWorld,tRegion,tAgent,tItem,tObj,ftSpec,tCol,ftTerm]).
% toplevel_type(InstISA):-ftSpec(InstISA).

get_ctx_isa(InstISA,Inst,InstISA):- toplevel_type(InstISA),must((isa(Inst,InstISA))),!.
get_ctx_isa(Inst,Inst,InstISA):- must(show_call(once(((toplevel_type(InstISA),isa(Inst,InstISA)))))),!.

system:assert_text(InstIn,String):- cwc, get_ctx_isa(InstIn,Inst,InstISA),!,assert_text(Inst,InstISA,String).

assert_text(Inst,InstISA,String):-  cwc,
       % context changed   and not the tWorld?
          % v this is for when there was no prior context
  ((parserVars(context,Inst0,_) -> (((Inst0 \==Inst),InstISA\==tWorld)
   -> (asserta_parserVars(isThis,Inst,InstISA)); true) ; (asserta_parserVars(isThis,Inst,InstISA))),
    locally(parserVars(context,Inst,InstISA),assert_text_now(Inst,InstISA,String))).

assert_text_now(Inst,InstISA,String):-
 on_f_log_ignore((
  % parse the string to attributed text
 to_word_list(String,WL),!,to_icase_strs(WL,IC),!,
   ((phrase(translation_dbg_on_fail(Inst,InstISA,PrologO),IC),
   ain(asserted_text(Inst,String,PrologO)),
     ain(onSpawn(PrologO)))))).

:- kb_shared(asserted_text/3).

tCol(describedTyped).
describedTyped(tRegion).
describedTyped(tObj).
(describedTyped(Col),isa(Inst,Col),mudDescription(Inst,String)/
  ( \+asserted_text(Inst,String,_), \+assert_text(Inst,String))) ==> mudDescriptionHarder(Inst,String).

:- export(to_icase_strs/2).
to_icase_strs(WL,IC):-maplist(to_icase_str,WL,IC).

:- export(to_icase_str/2).
% to_icase_str(SL,IC):-string_to_atom(SL,SA),string_to_atom(SS,SA),when(?=(IC,Y),(trace,(Y=SA;Y=SS))).
to_icase_str(SL,IC):-string_to_atom(SL,SA),string_to_atom(SS,SA),when(nonvar(IC);?=(IC,IC),(IC=SA;IC=SS)).

% somethingCanBe(tFountainDrink,[vSmall,vMedium,vLarge]).

translation_for(Room,'tRegion',(isa(Room,'tCorridor'),isa(Room,'tWellLit')),WS,[]):-concat_atom(WS,' ',O),if_defined(tag_pos(O,IO),fail),IO =
 ('S'('NP'('PRP'('You')),'VP'('VBP'(find),'NP'('PRP'(yourself)),'PP'('IN'(in),'NP'('NP'('DT'(the),'NN'(middle)),'PP'('IN'(of),
  'NP'('NP'('DT'(a),'ADJP'('RB'(well),'JJ'(lit)),'NN'(corridor)),'PP'('IN'(on),'NP'('DT'(the),'NN'('Enterprise')))))))))).

translation_for(_Inst,_InstISA,t(M,Prolog),WS,WE):- once((append(LeftSide,RightSide,WS), modality(M,List,Replace),append(LeftL,List,LeftSide),
  append(LeftL,List,LeftSide),append(LeftL,Replace,Left),
   append(Left,RightSide,NewWS))),
   translation_w(Prolog,NewWS,WE),!.
translation_for(_Inst,_InstISA,Prolog) --> translation_w(Prolog).
translation_for(_Inst,_InstISA,Prolog,WS,WE):-locally(loosePass,translation_w(Prolog,WS,WE)).

translation_dbg_on_fail(Inst,InstISA,Prolog)-->translation_for(Inst,InstISA,Prolog),!.
translation_dbg_on_fail(Inst,InstISA,Prolog,WS,WE):-locally(debugPass,translation_for(Inst,InstISA,Prolog,WS,WE)).

%:-assertz_if_new(parserTest(iWorld7,"Buffy the Labrador retriever is lounging here, shedding hair all over the place.")).
%:-assertz_if_new(parserTest(iWorld7,"You can also see a sugar candy doll house here.")).

mudKeyword(tItem,"thing").
mudKeyword(isSelfRegion,"here").
mudKeyword(tThing,"object").

==>
 type_action_info(tHumanControlled,
   actAddText(isOptional(tTemporalThing,isThis),ftText),
     "Development add some Text to a room.  Usage: addtext a sofa is in here").

a_command(Agent,actAddText(What,StringM)):- ground(What:StringM),
 locally(parserVars(isThis,What,ftTerm),
   locally(parserVars(isSelfAgent,Agent,tAgent),
       must(assert_text(What,StringM)))).

translation_w(t(M,Prolog),WS,WE):- once((append(LeftSide,RightSide,WS), modality(M,List,Replace),append(LeftL,List,LeftSide),append(LeftL,Replace,Left),
   append(Left,RightSide,NewWS))),translation_w(Prolog,NewWS,WE),!.
translation_w(Prolog) --> translation_spo(More2,P,S,O),!,{conjoin(More2,t(P,S,O),Prolog)}.

:-assertz_if_new(parserTest(iWorld7,"An emitter has a truth state called action keeping silent.",
   relationAllExists(mudActionKeepingSilient,tEmitter,ftBool))).

translation_w(relationAllExists(mudActionKeepingSilient,tEmitter,ftBoolean))
  --> ['An',emitter,has,a,truth,state,called,action,keeping,silent].

:-assertz_if_new(parserTest(iWorld7,"An object has a text called printed name.")).
translation_w(relationAllExists(P,C,DT))
  --> collection(C),[has,a],datatype(DT),[called],predicate_named(P).

collection(C)-->subject(C,tCol,true).
datatype(ftBoolean)--> dcgOptional(detn(_)),[truth,state].
datatype(ftText)--> dcgOptional(detn(_)),[text].
datatype(ftTerm)--> dcgOptional(detn(_)),[value].

predicate_named(Pred) --> dcgAnd(theText(Text),dcgLenBetween(1,5)),
  {toCamelAtom(Text,O),i_name(mud,O,Pred),ignore(assumed_isa(Pred,tPred))}.

:- dmsg(call(listing(predicate_named//1
              ))).

assumed_isa(I,C):-isa(I,C),!.
assumed_isa(I,C):-loosePass,assert_isa(I,C),!.

:- call(must(dcgAnd(dcgLenBetween(5,1),theText(_Text),[a,b,c],[]))).
:- must_or_rtrace(call(must(predicate_named(_P,[proper,-,named],[])))).

:-assertz_if_new(parserTest(iWorld7,"An object can be proper-named or improper-named.",partitionedInto(tObj,tProperNamed,tImproperNamed))).
translation_w(partitionedInto(C1,C2,C3)) --> collection(C1),[be],collection(C2),[or],collection(C3).

:-assertz_if_new(parserTest(iWorld7,"An object is usually improper-named.",relationMostInstance(isa,tObj,tImproperNamed))).
translation_w(relationMostInstance(isa,C1,C2)) --> collection(C1),[is,usually],collection(C2).

:-assertz_if_new(parserTest(iWorld7,"A thing can be scenery.", relationSomeInstance(isa,tItem,tScenery))).
translation_w(relationSomeInstance(isa,C1,C2)) --> collection(C1),[be],collection(C2).

:-assertz_if_new(parserTest(iWorld7,"The outside is a direction.", t(isa,vOutside,vtDirection))).
translation_w(isa(C1,C2)) --> detn(exists),col(v,C1),[is,a],col(vt,C2).

col(Pfx,C)-->subject(C,_,true),{atom_concat(Pfx,_,C)}.
col(_Pfx,C)-->{loosePass},subject(C,_,true).

% set of small things in the world
tCol(tSmall).  % I dont like doing this with adjectives.. but it cant be argued to be sane
tSmall(X) <==> mudSize(X,vSmall).

% set of green things in the world
tCol(tGreen).
tGreen(X) <==> mudColor(X,vGreen).

:-check_clause_counts.

%:-assertz_if_new(parserTest(iWorld7,"All green books are small.", (tGreen(X),tBook(X))==>tSmall(X))).
%:-assertz_if_new(parserTest(iWorld7,"Most green books are small.", pfc_default((tGreen(X),tBook(X))==>tSmall(X)))).

/*   The litmus

A thing can be lit or unlit. A thing is usually unlit.

Y can be C1 or C2.
Y is [usually] C2.

An object has a text called printed name.  --> relationAllExists(mudPrintedName,tObj,ftText).
An object has a text called printed plural name.  --> mudPrintedPluralName(tObj,ftText).
An object has a text called an indefinite article.  --> mudIndefinateArticle(tObj,ftText).
An object can be plural-named or singular-named. An object is usually singular-named.
                                                     --> partitionedInto(tObj,tSingularNamed,tPluralNamed).
                                                         relationMostInstance(isa,tObj,tSingularNamed).

An object can be proper-named or improper-named. An object is usually improper-named.
                                             --> partitionedInto(tObj,tProperNamed,tImproperNamed).
                                                 relationMostInstance(isa,tObj,tImproperNamed).

A room can be privately-named or publically-named. A room is usually publically-named.
                                             --> partitionedInto(tRoom,tPrivatelyNamed,tPublicallyNamed).
                                                 relationMostInstance(isa,tObj,tPublicallyNamed).

A room can be lighted or dark. A room is usually lighted.
A room can be visited or unvisited. A room is usually unvisited.
A room has a text called description.

A thing can be edible or inedible. A thing is usually inedible.
A thing can be fixed in place or portable. A thing is usually portable.

A thing can be scenery.   -->  relationSomeInstance(isa,tItem,tScenery).
A thing can be wearable.  -->  relationSomeInstance(isa,tItem,tWearAble).

A thing can be pushable between rooms.   -->  relationSomeInstance(isa,tItem,tPushAble).  % between rooms?

A direction is a type of value.  -->  isa(vtDirection,ttValueType).
The north is a direction.  -->  isa(vNorth,vtDirection).
The northeast is a direction.  --> ..
The northwest is a direction.
The south is a direction.
The southeast is a direction.
The southwest is a direction.
The east is a direction.
The west is a direction.
The up is a direction.
The down is a direction.
The inside is a direction.
The outside is a direction.

The north has opposite south. Understand "n" as north.   --> mudHasOpposite(vNorth,vSouth).  mudKeyword(vNorth,"n").
The northeast has opposite southwest. Understand "ne" as northeast.
The northwest has opposite southeast. Understand "nw" as northwest.
The south has opposite north. Understand "s" as south.
The southeast has opposite northwest. Understand "se" as southeast.
The southwest has opposite northeast. Understand "sw" as southwest.
The east has opposite west. Understand "e" as east.
The west has opposite east. Understand "w" as west.
Up has opposite down. Understand "u" as up.
Down has opposite up. Understand "d" as down.
Inside has opposite outside. Understand "in" as inside.
Outside has opposite inside. Understand "out" as outside.

??????? TODO ?????????
The inside object translates into I6 as "in_obj".
The outside object translates into I6 as "out_obj".

??????? TODO ?????????
The verb to be above implies the mapping up relation.
The verb to be mapped above implies the mapping up relation.
The verb to be below implies the mapping down relation.
The verb to be mapped below implies the mapping down relatio

A door has an object called other side.
The other side property translates into I6 as "door_to".
Leading-through relates one room (called the other side) to various doors.
The verb to be through implies the leading-through relation.

S33. Containers and supporters. The carrying capacity property is the exception to the remarks above
about the qualitative nature of the world model: here for the first and only time we have a value which can
be meaningfully compared.
Section SR1/6 - Containers
The specification of container is "Represents something into which portable
things can be put, such as a teachest or a handbag. Something with a really
large immobile interior, such as the Albert Hall, had better be a room
instead."
A container can be enterable.
A container can be opaque or transparent. A container is usually opaque.
A container has a number called carrying capacity.
The carrying capacity of a container is usually 100.
Include (- has container, -) when defining a container

The specification of supporter is "Represents a surface on which things can be
placed, such as a table."
A supporter can be enterable.
A supporter has a number called carrying capacity.
The carrying capacity of a supporter is usually 100.
A supporter is usually fixed in place.
Include (-
has transparent supporter
-) when defining a supporte

A door can be open or closed. A door is usually closed.
A door can be openable or unopenable. A door is usually openable.
A container can be open or closed. A container is usually open.
A container can be openable or unopenable. A container is usually unopenable.

Before rules is a rulebook. [20]
Instead rules is a rulebook. [21]
Check rules is a rulebook. [22]
Carry out rules is a rulebook. [23]
After rules is a rulebook. [24]
Report rules is a rulebook. [25]

Action-processing rules is a rulebook. [10]
The action-processing rulebook has a person called the actor.
Setting action variables is a rulebook. [11]
The specific action-processing rules is a rulebook. [12]
The specific action-processing rulebook has a truth state called action in world.
The specific action-processing rulebook has a truth state called action keeping silent.
The specific action-processing rulebook has a rulebook called specific check rulebook.
The specific action-processing rulebook has a rulebook called specific carry out rulebook.
The specific action-processing rulebook has a rulebook called specific report rulebook.
The specific action-processing rulebook has a truth state called within the player''s sight.
The player''s action awareness rules is a rulebook. [13]
S16. The rules on accessibility and visibility, which control whether an action is physically possible, have
named outcomes as a taste of syntactic sugar.
Accessibility rules is a rulebook. [14]
Reaching inside rules is an object-based rulebook. [15]
Reaching inside rules have outcomes allow access (success) and deny access (failure).
Reaching outside rules is an object-based rulebook. [16]
Reaching outside rules have outcomes allow access (success) and deny access (failure).
Visibility rules is a rulebook. [17]
Visibility rules have outcomes there is sufficient light (failure) and there is
insufficient light (success).
S17. Two rulebooks govern the processing of asking other people to carry out actions:
Persuasion rules is a rulebook. [18]
Persuasion rules have outcomes persuasion succeeds (success) and persuasion fails (failure).
Unsuccessful attempt by is a rulebook. [19

*/
:- include(prologmud(mud_footer)).
:- all_source_file_predicates_are_transparent.


text:
def max_difference(a: list[int]) -> tuple[int, int]:
    """
    We are given an array A[1..n] of integers, n >= 1. We want to
    find a pair of indices (i, j) such that
    1 <= i <= j <= n and A[j] - A[i] is as large as possible.

    Explanation:
    https://www.geeksforgeeks.org/maximum-difference-between-two-elements/

    >>> max_difference([5, 11, 2, 1, 7, 9, 0, 7])
    (1, 9)
    """
    # base case
    if len(a) == 1:
        return a[0], a[0]
    else:
        # split A into half.
        first = a[: len(a) // 2]
        second = a[len(a) // 2 :]

        # 2 sub problems, 1/2 of original size.
        small1, big1 = max_difference(first)
        small2, big2 = max_difference(second)

        # get min of first and max of second
        # linear time
        min_first = min(first)
        max_second = max(second)

        # 3 cases, either (small1, big1),
        # (min_first, max_second), (small2, big2)
        # constant comparisons
        if big2 - small2 > max_second - min_first and big2 - small2 > big1 - small1:
            return small2, big2
        elif big1 - small1 > max_second - min_first:
            return small1, big1
        else:
            return min_first, max_second

if __name__ == "__main__":
    import doctest

    doctest.testmod()

redpajama_set_name: RedPajamaGithub


text:
package io.spring.initializr.web.controller.custom;

import io.spring.initializr.generator.project.MutableProjectDescription;
import io.spring.initializr.generator.project.ProjectDescription;

/**
 * A custom {@link ProjectDescription} to convey the additional flags to contributors.
 *
 * @author Stephane Nicoll
 */
class CustomProjectDescription extends MutableProjectDescription {

	private boolean customFlag;

	CustomProjectDescription() {
	}

	CustomProjectDescription(CustomProjectDescription source) {
		super(source);
		this.customFlag = source.isCustomFlag();
	}

	@Override
	public CustomProjectDescription createCopy() {
		return new CustomProjectDescription(this);
	}

	boolean isCustomFlag() {
		return this.customFlag;
	}

	void setCustomFlag(boolean customFlag) {
		this.customFlag = customFlag;
	}

}


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

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

          Class
          AuditLog

            In:

                app/models/audit_log.rb

            Parent:

                ActiveRecord::Base

Purpose: This class represents an Audit Log entry, which provides a means
to track the actions which have been performed in the system.

Methods

      log

Public Class methods

          log(message, user_id = nil, record_id = nil)

Purpose: To help simplify logging of actions

Input:

message (String) - The action that occurred

user_id (Integer) [optional] - The id of the user who performed the action

record_id (Integer) [optional] - The bodysize record id associated with the
action

Output:

True if the message was successfully logged

False otherwise

[Validate]


text:
package org.ngbw.sdk.dataresources.lucene;

import java.io.IOException;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.lucene.store.Lock;
import org.apache.lucene.store.LockFactory;

class SFTPLockFactory extends LockFactory {

	private static Log log = LogFactory.getLog(SFTPLockFactory.class);
	private static final String lockFileName = "write.lock";
	SFTPDirectory directory;

	SFTPLockFactory(SFTPDirectory directory) {
		this.directory = directory;
	}

	/* (non-Javadoc)
	 * Attempt to clear (forcefully unlock and remove) the specified lock.
	 * Only call this at a time when you are certain this lock is no longer in use.
	 *
	 * @see org.apache.lucene.store.LockFactory#clearLock(java.lang.String)
	 */
	@Override
	public void clearLock(String lockDirName) throws IOException {
		if (directory.fileExists(lockFileName)) {
			if (log.isDebugEnabled())
				log.debug(lockFileName + " exists");
			directory.deleteFile(lockFileName);
		}
		if (directory.fileExists(lockFileName)) {
			log.error(lockFileName + " exists");
		}
	}

	/* (non-Javadoc)
	 * Return a new Lock instance identified by lockName.
	 *
	 * @see org.apache.lucene.store.LockFactory#makeLock(java.lang.String)
	 */
	@Override
	public Lock makeLock(String lockDirName) {
		Lock lock = new SFTPLock(directory, lockFileName);
		try {
			lock.obtain();
		} catch (IOException e) {
			throw new RuntimeException(e.toString(), e);
		}
		return lock;
	}

};

class SFTPLock extends Lock {

	private static Log log = LogFactory.getLog(SFTPLock.class);
	private SFTPDirectory directory;
	private String lockFileName;

	public SFTPLock(SFTPDirectory directory, String lockFileName) {
		if (log.isDebugEnabled())
			log.debug("get new instance");
		this.directory = directory;
		this.lockFileName = lockFileName;
	}

	/* (non-Javadoc)
	 * Returns true if the resource is currently locked.
	 * Note that one must still call obtain() before using the resource.
	 *
	 * @see org.apache.lucene.store.Lock#isLocked()
	 */
	@Override
	public boolean isLocked() {
		if (log.isDebugEnabled())
			log.debug("is it locked");
		//check whether the lock file exists in the
		//locked directory
		try {
			return directory.fileExists(lockFileName);
		} catch (IOException e) {
			throw new RuntimeException(e.toString(), e);
		}
	}

	/* (non-Javadoc)
	 * Attempts to obtain exclusive access and immediately return upon success or failure.
	 * Returns: true if exclusive access is obtained
	 *
	 * @see org.apache.lucene.store.Lock#obtain()
	 */
	@Override
	public boolean obtain() throws IOException {
		if (log.isDebugEnabled())
			log.debug("lock obtained");
		// TODO Auto-generated method stub
		//place the marker lock file in the directory
		//that is to be locked
		directory.touchFile(lockFileName);
		return isLocked();
	}

	/* (non-Javadoc)
	 * Releases exclusive access.
	 * @see org.apache.lucene.store.Lock#release()
	 */
	@Override
	public void release() {
		if (log.isDebugEnabled())
			log.debug("lock released");
		// TODO Auto-generated method stub
		//remove the marker lock file from the directory
		//that was locked
		try {
			directory.deleteFile(lockFileName);
		} catch (IOException e) {
			throw new RuntimeException(e.toString(), e);
		}
	}
}


text:
#ifndef BOOST_HANA_DETAIL_FAST_AND_HPP
#define BOOST_HANA_DETAIL_FAST_AND_HPP

#include <boost/hana/config.hpp>

#include <type_traits>

BOOST_HANA_NAMESPACE_BEGIN namespace detail {
    template <bool ...b>
    struct fast_and
        : std::is_same<fast_and<b...>, fast_and<(b, true)...>>
    { };
} BOOST_HANA_NAMESPACE_END

#endif // !BOOST_HANA_DETAIL_FAST_AND_HPP


text:
<!---
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License. See accompanying LICENSE file.
-->

## Python library for Apache Arrow

This library provides a Pythonic API wrapper for the reference Arrow C++
implementation, along with tools for interoperability with pandas, NumPy, and
other traditional Python scientific computing packages.

### Development details

This project is layered in two pieces:

* arrow_python, a library part of the main Arrow C++ project for Python,
  pandas, and NumPy interoperability
* Cython extensions and pure Python code under pyarrow/ which expose Arrow C++
  and pyarrow to pure Python users

#### PyArrow Dependencies:

To build pyarrow, first build and install Arrow C++ with the Python component
enabled using `-DARROW_PYTHON=on`, see
(https://github.com/apache/arrow/blob/master/cpp/README.md) . These components
must be installed either in the default system location (e.g. `/usr/local`) or
in a custom `$ARROW_HOME` location.

```shell
mkdir cpp/build
pushd cpp/build
cmake -DARROW_PYTHON=on -DCMAKE_INSTALL_PREFIX=$ARROW_HOME ..
make -j4
make install
```

If you build with a custom `CMAKE_INSTALL_PREFIX`, during development, you must
set `ARROW_HOME` as an environment variable and add it to your
`LD_LIBRARY_PATH` on Linux and OS X:

```bash
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ARROW_HOME/lib
```

5. **Python dependencies: numpy, pandas, cython, pytest**

#### Build pyarrow and run the unit tests

```bash
python setup.py build_ext --inplace
py.test pyarrow
```

To change the build type, use the `--build-type` option or set
`$PYARROW_BUILD_TYPE`:

```bash
python setup.py build_ext --build-type=release --inplace
```

To pass through other build options to CMake, set the environment variable
`$PYARROW_CMAKE_OPTIONS`.

#### Build the pyarrow Parquet file extension

To build the integration with [parquet-cpp][1], pass `--with-parquet` to
the `build_ext` option in setup.py:

```
python setup.py build_ext --with-parquet install
```

Alternately, add `-DPYARROW_BUILD_PARQUET=on` to the general CMake options.

```
export PYARROW_CMAKE_OPTIONS=-DPYARROW_BUILD_PARQUET=on
```

#### Build the documentation

```bash
pip install -r doc/requirements.txt
python setup.py build_sphinx
```

[1]: https://github.com/apache/parquet-cpp


text:
(function () {
  'use strict';

  function Logger($window, $log) {
    // set the angular providers onto logger
    this.$window = $window;
    this.$log = $log;

    // create the default logger
    this.createLog('default');

    // alias the default logger
    this.log    = this.default.log;
    this.warn   = this.default.warn;
    this.info   = this.default.info;
    this.error  = this.default.error;

    return this;
  }

  // logs dict
  Logger.prototype.logs = {};

  // standard logging level
  Logger.prototype._logLevel = 'error';

  // a wrapper for passing through arguments
  Logger.prototype.logWrapper = function(logName, level) {
    var self = this;
    var handlers = self.logs[logName].logHandlers[level];

    return function () {
      // capture the arguments on a var
      var args = arguments;
      // get the level for the current log
      var _level = self.logLevel(logName);

      // only call handlers if level is in the current tier
      if(self.logTiers[level] <= self.logTiers[_level]) {
        handlers.forEach(function (handler) {
            handler.apply(null, args);
        });
      }
    };
  };

  // set a global logging level
  Logger.prototype.setGlobablLogLevel = function(level) {
    this._logLevel = level;
  };

  // log levels
  Logger.prototype.logLevels = {
    log: 'log',
    info: 'info',
    warn: 'warn',
    error: 'error'
  };

  // get the appropriate log level
  Logger.prototype.logLevel = function(logName) {
    var self = this;
    logName = logName || 'default';
    // get the log level for a specific log else get the log level for all logs
    var logLevel = self.$window.localStorage.getItem('flannel.loglevel.' + logName);
    if(logLevel === null || logLevel === "") {
      logLevel = self.$window.localStorage.getItem('flannel.loglevel');
    }

    if(logLevel === null || logLevel === "") {
      logLevel = self[logName].logLevel;
    }

    if(logLevel === null || logLevel === "") {
      logLevel = self._logLevel;
    }

    return logLevel;
  };

  Logger.prototype.logTiers = {
    log   : 3,
    info  : 2,
    warn  : 1,
    error : 0
  };

  Logger.prototype.createLogHandlers = function() {
    return {
      log: [],
      info: [],
      warn: [],
      error: []
    };
  };

  Logger.prototype.setLogLevel = function (level) {
    this.default.logLevel = level;
  };

  Logger.prototype.setLoggingHandler = function(level, handler) {
    this.setHandler.call(this.default, level, handler);
  };

  Logger.prototype.createLog = function(logName) {
    var self = this;

    if(self[logName]) {
      throw new Error('Can not create log with that name');
    }

    self.logs[logName] = {
        name : logName, // name the log for decoration
        logLevel : null, // only use this if it's set specifically
        logHandlers : self.createLogHandlers(), // create the log handlers
        setLoggingHandler : self.setHandler // attach the setLogging handler
    };

    self.logs[logName].log    = self.logWrapper(logName, self.logLevels.log); // set up the basic log methods
    self.logs[logName].info   = self.logWrapper(logName, self.logLevels.info);
    self.logs[logName].error  = self.logWrapper(logName, self.logLevels.error);
    self.logs[logName].warn   = self.logWrapper(logName, self.logLevels.warn);

    // sets the log level for this log
    self.logs[logName].setLogLevel = function(level) {
      self.logs[logName].logLevel = level;
    };

    // alias the log onto logger
    self[logName] = self.logs[logName];
  };

  // set a handler for a log level
  Logger.prototype.setHandler = function(level, handler) {
    this.logHandlers[level].push(handler);
  };

  // set/enable the console.log handlers
  Logger.prototype.setDefaultHandlers = function(logName) {
    logName = logName || 'default';
    this.logs[logName].logHandlers.log.push(this.$log.log);
    this.logs[logName].logHandlers.warn.push(this.$log.warn);
    this.logs[logName].logHandlers.info.push(this.$log.info);
    this.logs[logName].logHandlers.error.push(this.$log.error);
  };

  if(angular !== undefined) {
    angular.module('flannel', [])
      .service('flannel.logger', ['$window', '$log', Logger]);
  }
  else {
    window.Flannel = function() {
      return new Logger(window, console || { log : noOp, warn : noOp, info : noOp, error : noOp});
    };
  }
  function noOp() { return; }
})();


text:
typedef void(^NSValueTransformerEasyCoderBlock) (NSValueTransformer * ins);

@interface NSValueTransformer (TFEasyCoder)

+( NSValueTransformer *)easyCoder:(NSValueTransformerEasyCoderBlock)block;
-(NSValueTransformer *)easyCoder:(NSValueTransformerEasyCoderBlock)block;

//superclass pros NSObject
-(NSValueTransformer  *(^)(NSArray *  accessibilityElements))set_accessibilityElements;
-(NSValueTransformer  *(^)(NSArray *  accessibilityCustomActions))set_accessibilityCustomActions;
-(NSValueTransformer  *(^)(BOOL  isAccessibilityElement))set_isAccessibilityElement;
-(NSValueTransformer  *(^)(NSString *  accessibilityLabel))set_accessibilityLabel;
-(NSValueTransformer  *(^)(NSString *  accessibilityHint))set_accessibilityHint;
-(NSValueTransformer  *(^)(NSString *  accessibilityValue))set_accessibilityValue;
-(NSValueTransformer  *(^)(unsigned long long  accessibilityTraits))set_accessibilityTraits;
-(NSValueTransformer  *(^)(UIBezierPath *  accessibilityPath))set_accessibilityPath;
-(NSValueTransformer  *(^)(CGPoint  accessibilityActivationPoint))set_accessibilityActivationPoint;
-(NSValueTransformer  *(^)(NSString *  accessibilityLanguage))set_accessibilityLanguage;
-(NSValueTransformer  *(^)(BOOL  accessibilityElementsHidden))set_accessibilityElementsHidden;
-(NSValueTransformer  *(^)(BOOL  accessibilityViewIsModal))set_accessibilityViewIsModal;
-(NSValueTransformer  *(^)(BOOL  shouldGroupAccessibilityChildren))set_shouldGroupAccessibilityChildren;
-(NSValueTransformer  *(^)(long long  accessibilityNavigationStyle))set_accessibilityNavigationStyle;

-(NSValueTransformer *(^)(id value,NSString *key))set_ValueKey;

@end


text:
using System.Diagnostics.CodeAnalysis;
#endif
using GraphQL.Types;
using GraphQL.Types.Relay;

namespace GraphQL.Builders
{
    /// <summary>
    /// Builds a connection field for graphs that have the specified source and return type.
    /// </summary>
    public class ConnectionBuilder<TSourceType, TReturnType>
    {
        private bool IsBidirectional => FieldType.Arguments?.Find("before")?.Type == typeof(StringGraphType) && FieldType.Arguments.Find("last")?.Type == typeof(IntGraphType);

        private int? PageSizeFromMetadata
        {
            get => FieldType.GetMetadata<int?>(ConnectionBuilder<TSourceType>.PAGE_SIZE_METADATA_KEY);
            set => FieldType.WithMetadata(ConnectionBuilder<TSourceType>.PAGE_SIZE_METADATA_KEY, value);
        }

        /// <summary>
        /// Returns the generated field.
        /// </summary>
        public FieldType FieldType { get; protected set; }

        /// <summary>
        /// Initializes a new instance for the specified <see cref="Types.FieldType"/>.
        /// </summary>
        protected internal ConnectionBuilder(FieldType fieldType)
        {
            FieldType = fieldType;
        }

        /// <summary>
        /// Returns a builder for new connection field for the specified node type.
        /// The edge type is <see cref="EdgeType{TNodeType}">EdgeType</see><<typeparamref name="TNodeType"/>>.
        /// The connection type is <see cref="ConnectionType{TNodeType, TEdgeType}">ConnectionType</see><<typeparamref name="TNodeType"/>, <see cref="EdgeType{TNodeType}">EdgeType</see><<typeparamref name="TNodeType"/>>>.
        /// </summary>
        /// <typeparam name="TNodeType">The graph type of the connection's node.</typeparam>
        public static ConnectionBuilder<TSourceType, TReturnType> Create<TNodeType>(string name = "default")
            where TNodeType : IGraphType => Create<TNodeType, EdgeType<TNodeType>>(name);

        /// <summary>
        /// Returns a builder for new connection field for the specified node and edge type.
        /// The connection type is <see cref="ConnectionType{TNodeType, TEdgeType}">ConnectionType</see><<typeparamref name="TNodeType"/>, <typeparamref name="TEdgeType"/>>
        /// </summary>
        /// <typeparam name="TNodeType">The graph type of the connection's node.</typeparam>
        /// <typeparam name="TEdgeType">The graph type of the connection's edge. Must derive from <see cref="EdgeType{TNodeType}">EdgeType</see><<typeparamref name="TNodeType"/>>.</typeparam>
        public static ConnectionBuilder<TSourceType, TReturnType> Create<TNodeType, TEdgeType>(string name = "default")
            where TNodeType : IGraphType
            where TEdgeType : EdgeType<TNodeType>
            => Create<TNodeType, TEdgeType, ConnectionType<TNodeType, TEdgeType>>(name);

        /// <summary>
        /// Returns a builder for new connection field for the specified node, edge and connection type.
        /// </summary>
        /// <typeparam name="TNodeType">The graph type of the connection's node.</typeparam>
        /// <typeparam name="TEdgeType">The graph type of the connection's edge. Must derive from <see cref="EdgeType{TNodeType}">EdgeType</see><<typeparamref name="TNodeType"/>>.</typeparam>
        /// <typeparam name="TConnectionType">The graph type of the connection. Must derive from <see cref="ConnectionType{TNodeType, TEdgeType}">ConnectionType</see><<typeparamref name="TNodeType"/>, <typeparamref name="TEdgeType"/>>.</typeparam>
        public static ConnectionBuilder<TSourceType, TReturnType> Create<TNodeType, TEdgeType, TConnectionType>(string name = "default")
            where TNodeType : IGraphType
            where TEdgeType : EdgeType<TNodeType>
            where TConnectionType : ConnectionType<TNodeType, TEdgeType>
        {
            var fieldType = new FieldType
            {
                Name = name,
                Type = typeof(TConnectionType),
                Arguments = new QueryArguments(
                    new QueryArgument<StringGraphType>
                    {
                        Name = "after",
                        Description = "Only return edges after the specified cursor.",
                    },
                    new QueryArgument<IntGraphType>
                    {
                        Name = "first",
                        Description = "Specifies the maximum number of edges to return, starting after the cursor specified by 'after', or the first number of edges if 'after' is not specified.",
                    }
                ),
            };

            return new ConnectionBuilder<TSourceType, TReturnType>(fieldType);
        }

        /// <summary>
        /// Configure the connection to be bi-directional.
        /// </summary>
        public virtual ConnectionBuilder<TSourceType, TReturnType> Bidirectional()
        {
            if (IsBidirectional)
                return this;

            Argument<StringGraphType, string>("before",
                "Only return edges prior to the specified cursor.");
            Argument<IntGraphType, int?>("last",
                "Specifies the maximum number of edges to return, starting prior to the cursor specified by 'before', or the last number of edges if 'before' is not specified.");

            return this;
        }

        /// <inheritdoc cref="FieldBuilder{TSourceType, TReturnType}.Name(string)"/>
        public virtual ConnectionBuilder<TSourceType, TReturnType> Name(string name)
        {
            FieldType.Name = name;
            return this;
        }

        /// <inheritdoc cref="FieldBuilder{TSourceType, TReturnType}.Description(string)"/>
        public virtual ConnectionBuilder<TSourceType, TReturnType> Description(string? description)
        {
            FieldType.Description = description;
            return this;
        }

        /// <inheritdoc cref="FieldBuilder{TSourceType, TReturnType}.DeprecationReason(string)"/>
        public virtual ConnectionBuilder<TSourceType, TReturnType> DeprecationReason(string? deprecationReason)
        {
            FieldType.DeprecationReason = deprecationReason;
            return this;
        }

        /// <summary>
        /// Sets the default page size or clears (if null) the default page size, so all records are returned by default.
        /// </summary>
        public virtual ConnectionBuilder<TSourceType, TReturnType> PageSize(int? pageSize)
        {
            PageSizeFromMetadata = pageSize;
            return this;
        }

        /// <summary>
        /// Adds an argument to the connection field.
        /// </summary>
        /// <typeparam name="TArgumentGraphType">The graph type of the argument.</typeparam>
        /// <param name="name">The name of the argument.</param>
        /// <param name="configure">A delegate to further configure the argument.</param>
        public virtual ConnectionBuilder<TSourceType, TReturnType> Argument<TArgumentGraphType>(string name, Action<QueryArgument>? configure = null)
            where TArgumentGraphType : IGraphType
        {
            var arg = new QueryArgument(typeof(TArgumentGraphType))
            {
                Name = name,
            };
            configure?.Invoke(arg);
            FieldType.Arguments!.Add(arg);
            return this;
        }

        /// <summary>
        /// Adds an argument to the connection field.
        /// </summary>
        /// <typeparam name="TArgumentGraphType">The graph type of the argument.</typeparam>
        /// <param name="name">The name of the argument.</param>
        /// <param name="description">The description of the argument.</param>
        /// <param name="configure">A delegate to further configure the argument.</param>
        public virtual ConnectionBuilder<TSourceType, TReturnType> Argument<TArgumentGraphType>(string name, string? description, Action<QueryArgument>? configure = null)
            where TArgumentGraphType : IGraphType
            => Argument<TArgumentGraphType>(name, arg =>
            {
                arg.Description = description;
                configure?.Invoke(arg);
            });

        /// <summary>
        /// Adds an argument to the connection field.
        /// </summary>
        /// <typeparam name="TArgumentGraphType">The graph type of the argument.</typeparam>
        /// <typeparam name="TArgumentType">The type of the argument value.</typeparam>
        /// <param name="name">The name of the argument.</param>
        /// <param name="description">The description of the argument.</param>
        /// <param name="defaultValue">The default value of the argument.</param>
        /// <param name="configure">A delegate to further configure the argument.</param>
        public virtual ConnectionBuilder<TSourceType, TReturnType> Argument<TArgumentGraphType, TArgumentType>(string name, string? description,
#if NETSTANDARD2_1
            [AllowNull]
#endif
            TArgumentType defaultValue = default!, Action<QueryArgument>? configure = null)
            where TArgumentGraphType : IGraphType
            => Argument<TArgumentGraphType>(name, arg =>
            {
                arg.Description = description;
                arg.DefaultValue = defaultValue;
                configure?.Invoke(arg);
            });

        /// <summary>
        /// Runs a configuration delegate for the connection field.
        /// </summary>
        public virtual ConnectionBuilder<TSourceType, TReturnType> Configure(Action<FieldType> configure)
        {
            configure(FieldType);
            return this;
        }

        /// <summary>
        /// Apply directive to connection field without specifying arguments. If the directive
        /// declaration has arguments, then their default values (if any) will be used.
        /// </summary>
        /// <param name="name">Directive name.</param>
        public virtual ConnectionBuilder<TSourceType, TReturnType> Directive(string name)
        {
            FieldType.ApplyDirective(name);
            return this;
        }

        /// <summary>
        /// Apply directive to connection field specifying one argument. If the directive
        /// declaration has other arguments, then their default values (if any) will be used.
        /// </summary>
        /// <param name="name">Directive name.</param>
        /// <param name="argumentName">Argument name.</param>
        /// <param name="argumentValue">Argument value.</param>
        public virtual ConnectionBuilder<TSourceType, TReturnType> Directive(string name, string argumentName, object? argumentValue)
        {
            FieldType.ApplyDirective(name, argumentName, argumentValue);
            return this;
        }

        /// <summary>
        /// Apply directive to connection field specifying configuration delegate.
        /// </summary>
        /// <param name="name">Directive name.</param>
        /// <param name="configure">Configuration delegate.</param>
        public virtual ConnectionBuilder<TSourceType, TReturnType> Directive(string name, Action<AppliedDirective> configure)
        {
            FieldType.ApplyDirective(name, configure);
            return this;
        }

        /// <summary>
        /// Sets the return type of the field.
        /// </summary>
        /// <typeparam name="TNewReturnType">The type of the return value of the resolver.</typeparam>
        public virtual ConnectionBuilder<TSourceType, TNewReturnType> Returns<TNewReturnType>()
        {
            return new ConnectionBuilder<TSourceType, TNewReturnType>(FieldType);
        }

        /// <summary>
        /// Sets the resolver method for the connection field. This method must be called after
        /// <see cref="PageSize(int?)"/> and/or <see cref="Bidirectional"/> have been called.
        /// </summary>
        public virtual void Resolve(Func<IResolveConnectionContext<TSourceType>, TReturnType?> resolver)
        {
            var isUnidirectional = !IsBidirectional;
            var pageSize = PageSizeFromMetadata;
            FieldType.Resolver = new Resolvers.FuncFieldResolver<TReturnType>(context =>
            {
                var connectionContext = new ResolveConnectionContext<TSourceType>(context, isUnidirectional, pageSize);
                CheckForErrors(connectionContext);
                return resolver(connectionContext);
            });
        }

        /// <summary>
        /// Sets the resolver method for the connection field. This method must be called after
        /// <see cref="PageSize(int?)"/> and/or <see cref="Bidirectional"/> have been called.
        /// </summary>
        public virtual void ResolveAsync(Func<IResolveConnectionContext<TSourceType>, Task<TReturnType?>> resolver)
        {
            var isUnidirectional = !IsBidirectional;
            var pageSize = PageSizeFromMetadata;
            FieldType.Resolver = new Resolvers.FuncFieldResolver<TReturnType>(context =>
            {
                var connectionContext = new ResolveConnectionContext<TSourceType>(context, isUnidirectional, pageSize);
                CheckForErrors(connectionContext);
                return new ValueTask<TReturnType?>(resolver(connectionContext));
            });
        }

        private static void CheckForErrors(IResolveConnectionContext<TSourceType> context)
        {
            if (context.First.HasValue && context.Last.HasValue)
            {
                throw new ArgumentException("Cannot specify both `first` and `last`.");
            }
            if (context.IsUnidirectional && context.Last.HasValue)
            {
                throw new ArgumentException("Cannot use `last` with unidirectional connections.");
            }
        }
    }
}


text:
#region Copyright
//=======================================================================================
// Microsoft Azure Customer Advisory Team
//
// This sample is supplemental to the technical guidance published on my personal
// blog at http://blogs.msdn.com/b/paolos/.
//
// Author: Paolo Salvatori
//=======================================================================================
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// LICENSED UNDER THE APACHE LICENSE, VERSION 2.0 (THE "LICENSE"); YOU MAY NOT USE THESE
// FILES EXCEPT IN COMPLIANCE WITH THE LICENSE. YOU MAY OBTAIN A COPY OF THE LICENSE AT
// http://www.apache.org/licenses/LICENSE-2.0
// UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING, SOFTWARE DISTRIBUTED UNDER THE
// LICENSE IS DISTRIBUTED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, EITHER EXPRESS OR IMPLIED. SEE THE LICENSE FOR THE SPECIFIC LANGUAGE GOVERNING
// PERMISSIONS AND LIMITATIONS UNDER THE LICENSE.
//=======================================================================================
#endregion

#region Using Directives

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using Microsoft.Azure.NotificationHubs;

#endregion

namespace ServiceBusExplorer.Helpers
{
    public class RegistrationInfo : INotifyPropertyChanged
    {
        #region Private Fields
        private RegistrationDescription registration;
        private string eTag;
        private DateTime? expirationTime;
        private string registrationId;
        private string tags;
        private string channelUri;
        #endregion

        #region Static Constructor
        static RegistrationInfo()
        {
            Registrations = new List<RegistrationInfo>();
        }
        #endregion

        #region Public Events
        public event PropertyChangedEventHandler PropertyChanged;
        #endregion

        #region Public Instance Properties
        public RegistrationDescription Registration
        {
            get
            {
                return registration;
            }
            set
            {
                if (value == registration)
                {
                    return;
                }
                registration = value;
                NotifyPropertyChanged();
            }
        }

        public string ETag
        {
            get
            {
                return eTag;
            }
            set
            {
                if (value == eTag)
                {
                    return;
                }
                eTag = value;
                NotifyPropertyChanged();
            }
        }

        public DateTime? ExpirationTime
        {
            get
            {
                return expirationTime;
            }
            set
            {
                if (value == expirationTime)
                {
                    return;
                }
                expirationTime = value;
                NotifyPropertyChanged();
            }
        }

        public string RegistrationId
        {
            get
            {
                return registrationId;
            }
            set
            {
                if (value == registrationId)
                {
                    return;
                }
                registrationId = value;
                NotifyPropertyChanged();
            }
        }

        public string Tags
        {
            get
            {
                return tags;
            }
            set
            {
                if (value == tags)
                {
                    return;
                }
                tags = value;
                NotifyPropertyChanged();
            }
        }

        public string ChannelUri
        {
            get
            {
                return channelUri;
            }
            set
            {
                if (value == channelUri)
                {
                    return;
                }
                channelUri = value;
                NotifyPropertyChanged();
            }
        }

        public string PlatformType
        {
            get
            {
                if (registration == null)
                {
                    return "unknown";
                }
                if (registration is WindowsTemplateRegistrationDescription)
                {
                    return "windowstemplate";
                }
                if (registration is WindowsRegistrationDescription)
                {
                    return "windows";
                }
                if (registration is MpnsTemplateRegistrationDescription)
                {
                    return "windowsphonetemplate";
                }
                if (registration is MpnsRegistrationDescription)
                {
                    return "windowsphone";
                }
                if (registration is AppleTemplateRegistrationDescription)
                {
                    return "appletemplate";
                }
                if (registration is AppleRegistrationDescription)
                {
                    return "apple";
                }
                if (registration is GcmTemplateRegistrationDescription)
                {
                    return "gcmtemplate";
                }
                if (registration is GcmRegistrationDescription)
                {
                    return "gcm";
                }
                return "unknown";
            }
        }
        #endregion

        #region Public Static Properties
        public static List<RegistrationInfo> Registrations { get; private set; }
        #endregion

        #region Public Static Methods
        public static void SetRegistrations(IEnumerable<RegistrationDescription> collection)
        {
            Registrations.Clear();
            if (collection != null)
            {
                foreach (var registration in collection)
                {
                    var registrationInfo = new RegistrationInfo
                        {
                            Registration = registration,
                            ETag = registration.ETag,
                            ExpirationTime = registration.ExpirationTime,
                            RegistrationId = registration.RegistrationId,
                            Tags = registration.Tags != null && registration.Tags.Any() ?
                                   registration.Tags.Aggregate((a, t) => a + "," + t) :
                                   null
                        };
                    if (registration is WindowsRegistrationDescription)
                    {
                        registrationInfo.ChannelUri = ((WindowsRegistrationDescription)registration).ChannelUri.ToString();
                    }
                    if (registration is MpnsRegistrationDescription)
                    {
                        registrationInfo.ChannelUri = ((MpnsRegistrationDescription)registration).ChannelUri.ToString();
                    }
                    if (registration is AppleRegistrationDescription)
                    {
                        registrationInfo.ChannelUri = ((AppleRegistrationDescription)registration).DeviceToken;
                    }
                    if (registration is GcmRegistrationDescription)
                    {
                        registrationInfo.ChannelUri = ((GcmRegistrationDescription)registration).GcmRegistrationId;
                    }
                    Registrations.Add(registrationInfo);
                }
            }
        }
        #endregion

        #region Private Methods
        // This method is called by the Set accessor of each property.
        // The CallerMemberName attribute that is applied to the optional propertyName
        // parameter causes the property name of the caller to be substituted as an argument.
        private void NotifyPropertyChanged([CallerMemberName] String propertyName = "")
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }
        #endregion
    }
}


text:
package com.google.zxing.client.android.encode;

import android.graphics.Bitmap;

import com.google.zxing.BarcodeFormat;
import com.google.zxing.EncodeHintType;
import com.google.zxing.MultiFormatWriter;
import com.google.zxing.WriterException;
import com.google.zxing.common.BitMatrix;

import java.util.EnumMap;
import java.util.Map;

/**
 * This class does the work of decoding the user's request and extracting all the data
 * to be encoded in a barcode.
 *
 * @author dswitkin@google.com (Daniel Switkin)
 */
public final class QRCodeEncoder {

    private static final int WHITE = 0x00FFFFFF;
    private static final int BLACK = 0xFF000000;

    private String contents;
    private BarcodeFormat format;
    private final int dimension;

    public QRCodeEncoder(final String contents, final BarcodeFormat format, final int dimension) {
        this.contents = contents;
        this.format = format;
        this.dimension = dimension;
    }

    public Bitmap encodeAsBitmap() throws WriterException {
        String contentsToEncode = contents;
        if (contentsToEncode == null) {
            return null;
        }
        Map<EncodeHintType, Object> hints = null;
        String encoding = guessAppropriateEncoding(contentsToEncode);
        if (encoding != null) {
            hints = new EnumMap<>(EncodeHintType.class);
            hints.put(EncodeHintType.CHARACTER_SET, encoding);
        }
        BitMatrix result;
        try {
            result = new MultiFormatWriter()
                    .encode(contentsToEncode, format, dimension, dimension, hints);
        } catch (IllegalArgumentException iae) {
            // Unsupported format
            return null;
        }
        int width = result.getWidth();
        int height = result.getHeight();
        int[] pixels = new int[width * height];
        for (int y = 0; y < height; y++) {
            int offset = y * width;
            for (int x = 0; x < width; x++) {
                pixels[offset + x] = result.get(x, y) ? BLACK : WHITE;
            }
        }

        Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
        bitmap.setPixels(pixels, 0, width, 0, 0, width, height);
        return bitmap;
    }

    private static String guessAppropriateEncoding(CharSequence contents) {
        // Very crude at the moment
        for (int i = 0; i < contents.length(); i++) {
            if (contents.charAt(i) > 0xFF) {
                return "UTF-8";
            }
        }
        return null;
    }

}


text:
/*
	forms should be named with a custom DOM ID, in case the DOM structure changes unexpectecly, so we make sure we send the right form.

	new RegExp(/([\d]+)(?:(\2)[\.])/g).exec(
	document.querySelector("#news").querySelectorAll("table")[2].querySelectorAll("tr.athing")[5].querySelector("td").innerHTML
	);

*/

var
	AVAILABLE=true,
	host="//"+document.location.host,
 	PROTOCOL=document.location.protocol,
//this changes to /x
	NEWS_PAGE=[host+"/news",host+"/",host],

	update_time=1400,
	sIMG_LOADER = chrome.extension.getURL("images/ajax-loader.gif"),
	t,
	timers=[],
	port,

	maintenance=false,
	//add .dev in the end to disable sending the version, so, that maintance flag can be used
	//version  ="1.3.3.dev",
	version="1.3.4",
	prev,
	username_hover,
	username_hover_out,
	BODY,
	obj1,
	text_calc;

var EVENTS={CLICK:"click"};

function calc_text (html) {
	text_calc.html(html);
	var height = (text_calc.height());//+ "px";
	var width = (text_calc.width());//+ "px";

	return {height:height,width:width};
}

function PopupMessage(id) {}

PopupMessage.prototype.start=function(callback, time) {
	this.timer=window.setTimeout(callback,(time==null)?200:time);
};

PopupMessage.prototype.destroy=function() {
	if (this.timer!=null) {
		window.clearTimeout(this.timer);
		this.timer=null;
	}
//	alert(this.timer);
};

PopupMessage.prototype.timer=null;

BODY=document.getElementsByTagName("body")[0];

function upTo(el, id) {

//  var t = el.parentNode;
  id = id.toLowerCase();

  while (t) {

    if (t.id && t.id.toLowerCase() == id) {
      return t;
    }
    t=el.parentNode;
  // Many DOM methods return null if they don't
  // find the element they are searching for
  // It would be OK to omit the following and just
  // return undefined
  return null;
  }
}

function find_parent (id, el) {
    // loop up until parent element is found
    while (el && el.id !== id) {
        el = el.parentNode;
    }
    // return found element
    return el;
};

window.onload=function() {
	$.ajax({
		url: "https://hackerne.ws/hackernewsux",//ROOT_ADMIN+"list-investment-accounts.jsp",
		type: "GET",
		data: (version.indexOf(".dev")==-1)?{
			"version": String(version)
		}: {},

		dataType: "json", //MIME must be "application/json"
		timeout: 3000
	}).done(function(data){
		try {

			if ((maintenance && data["status"]=="maintenance") ||
				(data["status_"+version]=="available")) {
					startup();
			} else {
				// if (development()) {

				// 	startup();
				// }
				// else
				console.log(version +" is not available. "+data['status']);
//				alert("not available");
			}
		} catch (X) {
			console.log("json parse error")
		}
	})
	.fail(function(jqXHR, textStatus, errorThrown) {
			console.log("fail to get status: "+textStatus);
			startup();
		});
}

function response_userinfo(data) {
   data.contents=data.contents.responseText;

   var info=['karma','about','avg','created'];
   var q,re,m,res='',i,results={};

   for (var k in info) {
		q=info[k]+":	([\\w\\s\\D]*?)	";

      	re = new RegExp(q, "g");
      	m = data.contents.match(re);

		if ( m != null) {
			for ( i = 0; i < m.length; i++ ) {
				//res += m[i];
				results[info[k]]=RegExp.$1;
			}
		}
   	}
	if (results.about!=null) {
		var r=new RegExp("("+"http"+":[^\r\n<>]*)","g");//   /(http:[^\r\n\s<>]*)/g
		results.about=results.about.replace(r,"$1");
		var r=new RegExp("("+"https"+":[^\r\n<>]*)","g");//   /(http:[^\r\n\s<>]*)/g
		results.about=results.about.replace(r,"$1");
	}

	var msg="karma: "+ results.karma+" | avg: "+results.avg+" | created: "+results.created+"
"+
		"
about
"+ ((results.about!=undefined)?results.about:"");

	var tooltip_txtcolor="black";
	var tooltip_bgcolor="#FFFFCC";//#FFFFCC
	var dim=calc_text(msg);

   	obj1.innerHTML=""+
		"
"+
			"

"+
			"
"+
				msg+
			"
"+
		  "
"+
		"";
   	obj1.onmouseover=function(e) {
	   		//console.log('destroy the timer that will hide user info')
			username_hover_out.destroy(); //the timer that hides obj1
		};

	$(obj1).mouseleave(function() {
		obj1.style.display='none';
	});

   	obj1.onclick=function(e) {
		obj1.style.display='none';
	};
}

function loadURL(href,callback,method,params) {
	console.log("loadURL >"+href);
	onRequest({user_info: href,method:method,params:params}, callback);
}

var loading_link, reply_link;

var LINK={REPLY:2, DISCUSSION:3};
function link_type(t) {
	if (typeof(t)=='object') t=t.innerHTML;

	if (typeof(t)=="string") {
		 //to be found index
		//var l= ((l=t.indexOf(" ")!=-1))?l:0;

		if (t.indexOf("comment")!=-1 || t.indexOf("discuss")==0) return LINK.DISCUSSION;
		else if (t.indexOf("reply")==0) return LINK.REPLY;

	}
	return false;
}

function getNewsTableFrom(container) {
	return container.getElementsByTagName("table")[2].cloneNode(true);
}

function right_panel() {
	//change more functionality to dynamic
	// append right column

	news_table=getNewsTableFrom(document);

	t1=document.createElement("table");
	tb1=document.createElement("tbody");
	tr1=document.createElement("tr");

	td1=document.createElement("td");
	td1.id='news';
	td1.appendChild(news_table);
	td1.vAlign="top";
	//td1.width="80%";
	tr1.appendChild(td1);

	tmp=document.createElement("td");
	tmp.width="1%";
	tmp.innerHTML=" ";
	tr1.appendChild(tmp);

	td2=document.createElement("td");
	td2.width='25%';td2.innerHTML='&nbsp';
	td2.id='td2';
	td2.vAlign="top";
	td2.style.borderLeft="1px solid #dfdfdf";
	td2.innerHTML="
"+""+"
";//";//
	tr1.appendChild(td2);

	tb1.appendChild(tr1);
	t1.appendChild(tb1);
	/*
	the problem is that threads are created by changing the width of a transparent image to a set width in pixels, therefore a table with a width% that results in less when calc-ed than the maximum trnsprent image width, the column cannot be minimized to 25%;
	*/

	document.getElementsByTagName("td")[4].innerHTML="";

	t1.style.padding = "0px 0px";
	t1.cellPadding = "0";
	t1.cellSpacing = "0";

	document.getElementsByTagName("td")[4].appendChild(t1);

	var _to="/newest";
	if ((_url=localStorage['current_page'])==null) {_url=PROTOCOL+host+_to;};

	try {
		more_news.replace(); //if replacemetn made before t1 appended, make sure there isnt direct call to document.innerhtml because news_table wont exist already
	}
	catch (Ex1) {
		alert('ex1::'+Ex1.message);
	}
	finally{
		window.setTimeout(
				function() {
					loadURL(_url,((localStorage['current_page']!=null)?callback_click:response_newest));
				},
				update_time
			);
	}
}

var reply_forms=0;

function callback_reply(data) {
	deleteHourglass(reply_link);
	neo=document.createElement("div");
	neo.innerHTML=data.contents.responseText;
	var frm=neo.getElementsByTagName("form");

	var ta=neo.getElementsByTagName("textarea");
	if (ta!=null) {ta[0].cols=null; ta[0].style.width="100%";}

	frm[0].id="reply_form"+(++reply_forms);

//replace the functionality of the submit button
	neo.innerHTML=neo.innerHTML.replace(/<input type=\"submit\"[^>]*>/g,"<input id='reply_text_"+reply_forms+"' type=submit value=\"reply\">");
	neo.innerHTML=frm[0].outerHTML;

	reply_link.parentNode.insertBefore(neo,reply_link.nextSibling)
	var onclick=function() {
		return (function send(form){
			if(form.elements[1].value.length>0) {
				enableForm(form,false);
				sendForm(form,function(data) {
					//callback_click(data,true); //insert the new contents and scroll

					if (form.elements[1].value.length==0) enableForm(form);

				});
			}
			return false;
		})(frm[0]);
	};
	document.getElementById('reply_text_'+reply_forms).addEventListener("click",onclick);
}

var loaded;
var MANUAL_CLICK=true;
var debug;

function callback_click(data,user_click) {
	if(loading_link!=null) {
			deleteHourglass(loading_link);
			loaded=loading_link;
		}

	var tmp=document.createElement("div");
	tmp.innerHTML=data.contents.responseText;

	console.log(debug);
	var ta=tmp.getElementsByTagName("textarea");
	if (ta.length>0)  {ta[0].cols=null; ta[0].style.width="100%";}
	var newest_content=document.getElementById('$content_newest');
	newest_content.innerHTML=tmp.getElementsByTagName("td")[4].innerHTML;

	resizeSlide(65);
	newest_content.innerHTML=newest_content.innerHTML.replace(/<input type=\"submit\"[^>]*>/g,"<input id='comment_input' type=submit value=\"add comment\">");

	$input=document.getElementById('comment_input');
	if ($input)
	$input.onclick= function() {
		//comment click

		function send(){
		if (document.forms[0].elements[1].value.length>0) {
			enableForm(document.forms[0],false);
			sendForm(document.forms[0],function(data) {
				callback_click(data,true); //insert the new contents;
					if (document.forms[0].elements[1].value.length==0) enableForm(document.forms[0]);

				});
		}
		return false;
		}

		return send();
	};

	if (user_click) {
		//remove hourglass

		var s; t=500;//msec, in how much time to complete the visual
		var interval=30; //update interval of screen

		var steps=t/interval;//determines smoothness

		if ((s=parseInt(BODY.scrollTop))>0) {
			v=(s*1000)/t; //velocity per ms, to complete the distance in req. time

		s=(v/1000)*interval;

		animate(function () {

			if (parseInt(BODY.scrollTop)>0) {
				BODY.scrollTop-=s;
				return true;
			}
		return false;
		});}

	} else {localStorage.removeItem('current_page');}

}

var vote_function="function vote2(node) {GLO='1';"+//"var node=this;"+
""+
"  var v = node.id.split(/_/);var item = v[1];"+

"  var score = byId('score_' + item);"+
"  if (score!=null) {var newscore = parseInt(score.innerHTML) + (v[0] == 'up' ? 1 : -1);"+
"  score.innerHTML = newscore + (newscore == 1 ? ' point' : ' points');}"+

"  score = byId('score_' + item+'_HN');"+
"  if (score!=null){newscore = parseInt(score.innerHTML) + (v[0] == 'up' ? 1 : -1);"+
"  score.innerHTML = newscore + (newscore == 1 ? ' point' : ' points');}"+

"  /* hide arrows*/ var arrow;"+
" arrow=byId('up_'   + item); if (arrow!=null) arrow.style.visibility = 'hidden';"+
"  arrow=byId('up_'   + item+'_HN'); if (arrow!=null) arrow.style.visibility = 'hidden';"+

"  arrow=byId('down_' + item); if (arrow!=null) arrow.style.visibility = 'hidden';"+
"  arrow=byId('down_' + item+'_HN');if (arrow!=null) arrow.style.visibility = 'hidden';"+

"  var ping = new Image();ping.src = node.href; return false;} return vote2(this); ";

function resizeSlide(targetWidth) {
	var news_col=document.getElementById('td2');

		animate(function() {w=parseInt(document.getElementById('td2').width);

				if (w<targetWidth) {//w>37){
					document.getElementById('td2').width=String(parseInt(w+1))+"%";
					return true;
				}
				return false;
			}
		);
}

function animate(callback) {
	var speed;
	if (callback()) window.setTimeout(function() {animate(callback)},30);
}

function indexStoryItems() {

}

function response_newest(data) {
	//console.log('response_newest >' + data.contents.responseText)
	data.contents=data.contents.responseText;

	var content_newest =document.getElementById("$content_newest");
	//content_newest.innerHTML=
	resizeSlide(50);
//	q='

(?:[\\s\\S]*)([\\w\\s\\D]*?)More
(?:[\\s\\S]*)

';

//	q='
(?:[\\s\\S]*)
(?:[\\s\\S]*)([\\w\\s\\D]*?)More(?:[\\s\\r\\n]*)
(?:[\\s\\r\\n]*)
(?:[\\s\\r\\n]*)

';
	//q='
(?:[\\s\\S]*)
(?:[\\s\\S]*)
(?:[\\s\\S]*)([\\w\\s\\D]*?)More(?:[\\s\\r\\n]*)
(?:[\\s\\r\\n]*)
(?:[\\s\\r\\n]*)
(?:[\\s\\r\\n]*)
'
	q='
(?:[\\s\\S]*)
(?:[\\s\\S]*)
(?:[\\s\\S]*)([\\w\\s\\D]*?)More(?:[\\s\\r\\n]*)
(?:[\\s\\r\\n]*)
(?:[\\s\\r\\n]*)
(?:[\\s\\r\\n]*)
';

	re=new RegExp(q,"gi");

	m= re.exec(data.contents)

	content_newest.innerHTML=m[0];

	content_newest.innerHTML=content_newest.innerHTML.replace(/id=\"([^\s>]*)\"/g,"id=\"$1_HN\"");
	content_newest.innerHTML=content_newest.innerHTML.replace(/return (vote\(this\))/g,vote_function);

	more_newest.replace();

}

var _; //instance of the dom framework
function startup() {
	console.log('startup, version ='+version);//+",dev="+development);

	_=new DOM(BODY);

	username_hover=new PopupMessage();
	username_hover_out=new PopupMessage();

	obj1=document.createElement("div");
		obj1.style.position="absolute";
		obj1.innerHTML="$user";
		obj1.style.display='none';
	BODY.appendChild(obj1);

	text_calc=$("

").width(400).css("position","absolute").css("left","-4000");

	$("body").append(
			text_calc
		);

	if (AVAILABLE)  {

	  for (var j in NEWS_PAGE) {
	  	//console.log(PROTOCOL+NEWS_PAGE[j])
	    if (document.location.href==PROTOCOL+NEWS_PAGE[j]) {
		right_panel();

		break;
	    }
	  }

  BODY.onclick= function (e) {
	if (e.srcElement.tagName=="A") { //not the middle button which opens a new tab
	//	alert('link type: '+ link_type(e.srcElement));

		if (link_type(e.srcElement)==LINK.REPLY) {
			e.preventDefault();

			deleteHourglass(reply_link);

			reply_link=e.srcElement;
			createHourglass(reply_link);

			loadURL(e.srcElement.href,function(data) {callback_reply(data);});

			return false;
		} else	if (link_type(e.srcElement)!=LINK.DISCUSSION) {
			if (e.button==0 && e.srcElement.href!=null) if (e.srcElement.href.indexOf(host)==-1) {

				if (loaded!=null)
					localStorage['current_page']=loaded.href;
				//top.location.href=e.srcElement.href;
			}
		} else {
			if (document.getElementById('td2')!=null && e.button!=1) {
				e.preventDefault();
				deleteHourglass(loading_link);

				loading_link=e.srcElement;
				createHourglass(loading_link);

				loadURL(e.srcElement.href,function(data) {callback_click(data,true);});
				return false;
			}

		}

	}
  };

  var BODYonmouseover= function(e) {
	if ((t=e.srcElement.href)!=null) if (t.indexOf("user?")!=-1) {

		var a=e;

		username_hover_out.destroy(); //remove the timer that hides the tooltip
		username_hover.start(function() {hover(a)}, 350);

		if (e.srcElement.onmouseout==null)  {
			onmouseout=function(e) {
				//if (e.srcElement.parentNode.id=='user_inf') return;
				// return;

				username_hover.destroy();
				prev=''; var o=e;
				username_hover_out.start(function(e) {
					//obj1.style.display='none';
					//console.log(448)
					//o.srcElement.onmouseout=null;
				},200);
			};
			e.srcElement.addEventListener("mouseout",onmouseout);
		}
    }
  };

	BODY.addEventListener('mouseover', BODYonmouseover);
}

}  //-end-startup()

function LOAD_URL_html (url,callback,method) {
	var req=new XMLHttpRequest();

	req.onreadystatechange = callback;
	req.open(((method==null)?'GET':method),url,true);
	req.send();
}

function enableForm(form,flag){flag=(flag==null)?false:true; for (var el in form.elements){ form.elements[el].disabled=flag;} }

function deleteHourglass(el) {
	if (el!=null) if (el.innerHTML!=null) if (el.innerHTML.indexOf("&")!=-1)
		el.innerHTML=el.innerHTML.substring(0,el.innerHTML.indexOf("&"));

}

function createHourglass(el) {
	el.innerHTML+=" ";
}

function hover(e) {
   var t;
	username_hover.destroy(); //the timer that showed hover

     if (prev!=e.srcElement.href) {
		prev=e.srcElement.href;
		obj1.style.display='';

		obj1.style.left=BODY.scrollLeft+e.clientX;
		obj1.style.top=BODY.scrollTop+e.clientY-30;
		loadURL(e.srcElement.href,response_userinfo);

		obj1.innerHTML="";
	}
}

/* dynamic_more(): replace functionality of anchor "More" with the given callback function;

	container: where the anchor <More> lives, should not be BODY because events are replaced.
*/

function dynamic_more(container,dom_id) {
	//create this <input id='btn_more' href='$1' type=button value='More'>

}

var more_news=new MORE('news',"btn_news_more");
var more_newest=new MORE('$content_newest',"btn_newest_more");

function MORE(container, btn_dom_id) {
	this.container=container;
	this.dom_id=btn_dom_id;
}

MORE.prototype.replace=function() {
	var res=this.replaceFunction();//,btn1.outerHTML);//container.innerHTML=res.html;
	var aa=this;
	var c="container_"+this.dom_id;
	c=document.getElementById(c);

	var btn1=createButton({id:this.dom_id,href:res.href,click: function(e) {
				e.srcElement.disabled=true;
				var dom_id=e.srcElement.id, a=aa;

				if (this.href.indexOf("/")!=0) this.href="/"+this.href;

				//console.log("get news from"+this.href)

				loadURL(PROTOCOL+host+this.href,function(data){a.display(data,dom_id);});
			 	var c="container_"+aa.dom_id;
			 	document.getElementById(c);
			 	if (c!=null)
				 	c.innerHTML+="";
			}
	});
//	console.log(this.dom_id);
	if (c!=null)
		c.appendChild(btn1);
}

/*
	called when loadURL completes loading More page
*/

MORE.prototype.display=function(data) {
	data=data.contents.responseText;
	var tmp=document.createElement("div");
	tmp.innerHTML=data;
	//console.log(tmp)
	tmp=getNewsTableFrom(tmp); //get only the news table;

	removeElement("container_"+this.dom_id);//remove the previous container of the More button

	document.getElementById(this.container).innerHTML+="
"+tmp.innerHTML+"
";

	this.replace();
};

MORE.prototype.container=null;
MORE.prototype.dom_id=null;

function removeElement(id) {
	var a=document.getElementById(id);
	if (a.parentElement!=null)
		a.parentElement.removeChild(a);
	else if (a.removeNode!=null)
		a.removeNode(true);
}
/* creates an HTML input element button
   params.id
*/
createButton=function (params) {
var btn1=document.createElement("input");
	btn1.id=params.id;
	btn1.value="More";
	btn1.type="button";
	btn1.href=params.href;
	btn1.onclick= params.click;
return btn1;
};

MORE.prototype.replaceFunction=function() { //replaceWith) {
	var container=document.getElementById(this.container);

	var replaceWith="

";//:replaceWith;

	var re=new RegExp("<a href=\"([^.<>]*)\"[^>]*>More");
	var m=container.innerHTML.match(re);

	container.innerHTML=container.innerHTML.replace(re,replaceWith);//"<input id='btn_more' href='$1' type=button value='More'>";);

	//MORE.href=RegExp.$1;//res.href;
//dirty fix because once is news2 other time x?id
	return {html: container.innerHTML, href:RegExp.$1.split(" ")[0].replace("\"",""),id:this.dom_id};

};

function DOM(dom) {
	this.base=(dom!=null)?dom:document.body;
}

DOM.prototype.get= function(id) {
	return this.base.getElementById(id);
};

function sendForm(form,callback) {
	var params="";

	for (var el in form.elements) {
		params+=form.elements[el].name+"="+encodeURIComponent(form.elements[el].value)+"&";
	}

	if (params!=null) params=params.substring(0,params.length-1);

	//chrome.extension.sendMessage({user_info: form.action,method:form.method,params:params}, callback);

	onRequest({user_info: form.action,method:form.method,params:params}, callback);
}

function onRequest(request, sendResponse) {
    if (request.user_info !=null) {

		QUEUE({url:request.user_info,callback:function () {
		console.log("onRequest.callback > " + req.status+","+req.readyState);
		//console.log(req.responseText);
		 if (req.readyState == 4) {
            if (req.status == 200) {
				sendResponse({contents: req})
	    	}
		    executeQueue(true);
	  	 }
		},params:request.params,method:request.method
	});

    } else {
    	log.console('28 something missing')
    }
}

var XHR=[];
var xhr_cursor=0;
var xhr_loading=0;
var req=new XMLHttpRequest();

function openXML(url,callback,method,params) {
	req.onreadystatechange = callback;
	req.open(((method==null)?"GET":"POST"),url,true);
	if (params!=null) {
		req.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		 req.send(params);
	} else req.send();
}

function QUEUE(params) {
	XHR[XHR.length]=params;
	if (xhr_loading==0) executeQueue();
}

function executeQueue(wait) {
	if (XHR.length>0 && xhr_cursor+1<=XHR.length) {
		xhr_loading=1;
	 	if (wait) { //to get outside of the recursive, if called within onreadystatechange
			window.setTimeout(function() {execute();},100);
		} else {
			execute();
		}
	} else { xhr_loading=0; XHR=[]; xhr_cursor=0;}
}

function execute() {
	var request=XHR[xhr_cursor++];
	if (request!=undefined) openXML(request.url, request.callback,request.method,request.params);
}


text:
ACCEPTED

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Persoonia 10(3): 335 (1979)

#### Original name
Aleurodiscus delicatus Wakef., 1952

### Remarks
null


text:
from typing import Any, Dict

from airflow.providers.amazon.aws.hooks.base_aws import AwsBaseHook

class GlacierHook(AwsBaseHook):
    """Hook for connection with Amazon Glacier"""

    def __init__(self, aws_conn_id: str = "aws_default") -> None:
        super().__init__(client_type="glacier")
        self.aws_conn_id = aws_conn_id

    def retrieve_inventory(self, vault_name: str) -> Dict[str, Any]:
        """
        Initiate an Amazon Glacier inventory-retrieval job

        :param vault_name: the Glacier vault on which job is executed
        :type vault_name: str
        """
        job_params = {'Type': 'inventory-retrieval'}
        self.log.info("Retrieving inventory for vault: %s", vault_name)
        response = self.get_conn().initiate_job(vaultName=vault_name, jobParameters=job_params)
        self.log.info("Initiated inventory-retrieval job for: %s", vault_name)
        self.log.info("Retrieval Job ID: %s", response["jobId"])
        return response

    def retrieve_inventory_results(self, vault_name: str, job_id: str) -> Dict[str, Any]:
        """
        Retrieve the results of an Amazon Glacier inventory-retrieval job

        :param vault_name: the Glacier vault on which job is executed
        :type vault_name: string
        :param job_id: the job ID was returned by retrieve_inventory()
        :type job_id: str
        """
        self.log.info("Retrieving the job results for vault: %s...", vault_name)
        response = self.get_conn().get_job_output(vaultName=vault_name, jobId=job_id)
        return response

    def describe_job(self, vault_name: str, job_id: str) -> Dict[str, Any]:
        """
        Retrieve the status of an Amazon S3 Glacier job, such as an
        inventory-retrieval job

        :param vault_name: the Glacier vault on which job is executed
        :type vault_name: string
        :param job_id: the job ID was returned by retrieve_inventory()
        :type job_id: str
        """
        self.log.info("Retrieving status for vault: %s and job %s", vault_name, job_id)
        response = self.get_conn().describe_job(vaultName=vault_name, jobId=job_id)
        self.log.info("Job status: %s, code status: %s", response['Action'], response['StatusCode'])
        return response


text:
module Xero
  module Errors
    class NotFound < StandardError
    end
  end
end


text:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.yaozongyou.listviewtest"
    android:versionCode="1"
    android:versionName="1.0" >

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" >
        <activity
            android:name="com.yaozongyou.listviewtest.MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>


text:
namespace newtelligence.DasBlog.Web {

    /// <summary>
    /// FormatPage class.
    /// </summary>
    /// <remarks>
    /// Auto-generated class.
    /// </remarks>
    public partial class FormatPage {

        /// <summary>
        /// contentPlaceHolder control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.PlaceHolder contentPlaceHolder;
    }
}


text:
using Microsoft.IO;

namespace TinyIpc;

internal static class MemoryStreamPool
{
	public static RecyclableMemoryStreamManager Manager { get; } = new();
}


text:
NAME

SYNOPSIS

command [options] [args]
OVERVIEW

The Synchronization TeXnology is a feature of recent TeX engines. It allows to synchronize between input and output, which means to navigate from the source document to the typeset material and vice versa.

Run `synctex help' to access the built-in tool documentation.
SEE ALSO

AUTHOR

The Synchronize TeXnology is essentially due to Jerome Laurens, with useful suggestions by some well known actors of the TeX world.
HISTORY           \ Document history if command behaves in a unique manner

This document has never been updated.


text:
require([
    "jQuery",
    "utils/storage",
    "utils/analytic",
    "utils/sharing",

    "core/state",
    "core/keyboard",
    "core/exercise",
    "core/progress",
    "core/sidebar",
    "core/search"
], function($, storage, analytic, sharing, state, keyboard, exercise, progress, sidebar, search){
    $(document).ready(function() {
        var $book = state.$book;

        // Init sidebar
        sidebar.init();

        // Load search
        search.init();

        // Init keyboard
        keyboard.init();

        if (state.githubId) {
            // Initialize storage
            storage.setBaseKey(state.githubId);

            // Star and watch count
            $.getJSON("https://api.github.com/repos/"+state.githubId)
            .done(function(repo) {
                $book.find(".count-star span").text(repo.stargazers_count);
                $book.find(".count-watch span").text(repo.subscribers_count);
            });
        }

        // Bind exercise
        exercise.init();

        // Bind sharing button
        sharing.init();

        // Show progress
        progress.show();

        // Focus on content
        $(".book-body").focus();
    });
});


text:
.class public final Llibcore/icu/AlphabeticIndex;
.super Ljava/lang/Object;
.source "AlphabeticIndex.java"

# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Llibcore/icu/AlphabeticIndex$1;,
        Llibcore/icu/AlphabeticIndex$ImmutableIndex;
    }
.end annotation

# instance fields
.field private peer:J

# direct methods
.method public constructor <init>(Ljava/util/Locale;)V
    .locals 2
    .param p1, "locale"    # Ljava/util/Locale;

    .prologue
    .line 80
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 81
    invoke-virtual {p1}, Ljava/util/Locale;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-static {v0}, Llibcore/icu/AlphabeticIndex;->create(Ljava/lang/String;)J

    move-result-wide v0

    iput-wide v0, p0, Llibcore/icu/AlphabeticIndex;->peer:J

    .line 82
    return-void
.end method

.method static synthetic access$000(J)V
    .locals 0
    .param p0, "x0"    # J

    .prologue
    .line 24
    invoke-static {p0, p1}, Llibcore/icu/AlphabeticIndex;->destroy(J)V

    return-void
.end method

.method private static native addLabelRange(JII)V
.end method

.method private static native addLabels(JLjava/lang/String;)V
.end method

.method private static native buildImmutableIndex(J)J
.end method

.method private static native create(Ljava/lang/String;)J
.end method

.method private static native destroy(J)V
.end method

.method private static native getBucketCount(J)I
.end method

.method private static native getBucketIndex(JLjava/lang/String;)I
.end method

.method private static native getBucketLabel(JI)Ljava/lang/String;
.end method

.method private static native getMaxLabelCount(J)I
.end method

.method private static native setMaxLabelCount(JI)V
.end method

# virtual methods
.method public declared-synchronized addLabelRange(II)Llibcore/icu/AlphabeticIndex;
    .locals 2
    .param p1, "codePointStart"    # I
    .param p2, "codePointEnd"    # I

    .prologue
    .line 127
    monitor-enter p0

    :try_start_0
    iget-wide v0, p0, Llibcore/icu/AlphabeticIndex;->peer:J

    invoke-static {v0, v1, p1, p2}, Llibcore/icu/AlphabeticIndex;->addLabelRange(JII)V
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    .line 128
    monitor-exit p0

    return-object p0

    .line 127
    :catchall_0
    move-exception v0

    monitor-exit p0

    throw v0
.end method

.method public declared-synchronized addLabels(Ljava/util/Locale;)Llibcore/icu/AlphabeticIndex;
    .locals 3
    .param p1, "locale"    # Ljava/util/Locale;

    .prologue
    .line 118
    monitor-enter p0

    :try_start_0
    iget-wide v0, p0, Llibcore/icu/AlphabeticIndex;->peer:J

    invoke-virtual {p1}, Ljava/util/Locale;->toString()Ljava/lang/String;

    move-result-object v2

    invoke-static {v0, v1, v2}, Llibcore/icu/AlphabeticIndex;->addLabels(JLjava/lang/String;)V
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    .line 119
    monitor-exit p0

    return-object p0

    .line 118
    :catchall_0
    move-exception v0

    monitor-exit p0

    throw v0
.end method

.method protected declared-synchronized finalize()V
    .locals 2
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/lang/Throwable;
        }
    .end annotation

    .prologue
    .line 86
    monitor-enter p0

    :try_start_0
    iget-wide v0, p0, Llibcore/icu/AlphabeticIndex;->peer:J

    invoke-static {v0, v1}, Llibcore/icu/AlphabeticIndex;->destroy(J)V

    .line 87
    const-wide/16 v0, 0x0

    iput-wide v0, p0, Llibcore/icu/AlphabeticIndex;->peer:J
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    .line 89
    :try_start_1
    invoke-super {p0}, Ljava/lang/Object;->finalize()V
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_1

    .line 91
    monitor-exit p0

    return-void

    .line 89
    :catchall_0
    move-exception v0

    :try_start_2
    invoke-super {p0}, Ljava/lang/Object;->finalize()V

    throw v0
    :try_end_2
    .catchall {:try_start_2 .. :try_end_2} :catchall_1

    .line 86
    :catchall_1
    move-exception v0

    monitor-exit p0

    throw v0
.end method

.method public declared-synchronized getBucketCount()I
    .locals 2

    .prologue
    .line 135
    monitor-enter p0

    :try_start_0
    iget-wide v0, p0, Llibcore/icu/AlphabeticIndex;->peer:J

    invoke-static {v0, v1}, Llibcore/icu/AlphabeticIndex;->getBucketCount(J)I
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    move-result v0

    monitor-exit p0

    return v0

    :catchall_0
    move-exception v0

    monitor-exit p0

    throw v0
.end method

.method public declared-synchronized getBucketIndex(Ljava/lang/String;)I
    .locals 2
    .param p1, "s"    # Ljava/lang/String;

    .prologue
    .line 144
    monitor-enter p0

    :try_start_0
    iget-wide v0, p0, Llibcore/icu/AlphabeticIndex;->peer:J

    invoke-static {v0, v1, p1}, Llibcore/icu/AlphabeticIndex;->getBucketIndex(JLjava/lang/String;)I
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    move-result v0

    monitor-exit p0

    return v0

    :catchall_0
    move-exception v0

    monitor-exit p0

    throw v0
.end method

.method public declared-synchronized getBucketLabel(I)Ljava/lang/String;
    .locals 2
    .param p1, "index"    # I

    .prologue
    .line 151
    monitor-enter p0

    :try_start_0
    iget-wide v0, p0, Llibcore/icu/AlphabeticIndex;->peer:J

    invoke-static {v0, v1, p1}, Llibcore/icu/AlphabeticIndex;->getBucketLabel(JI)Ljava/lang/String;
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    move-result-object v0

    monitor-exit p0

    return-object v0

    :catchall_0
    move-exception v0

    monitor-exit p0

    throw v0
.end method

.method public declared-synchronized getImmutableIndex()Llibcore/icu/AlphabeticIndex$ImmutableIndex;
    .locals 4

    .prologue
    .line 158
    monitor-enter p0

    :try_start_0
    new-instance v0, Llibcore/icu/AlphabeticIndex$ImmutableIndex;

    iget-wide v2, p0, Llibcore/icu/AlphabeticIndex;->peer:J

    invoke-static {v2, v3}, Llibcore/icu/AlphabeticIndex;->buildImmutableIndex(J)J

    move-result-wide v2

    const/4 v1, 0x0

    invoke-direct {v0, v2, v3, v1}, Llibcore/icu/AlphabeticIndex$ImmutableIndex;-><init>(JLlibcore/icu/AlphabeticIndex$1;)V
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    monitor-exit p0

    return-object v0

    :catchall_0
    move-exception v0

    monitor-exit p0

    throw v0
.end method

.method public declared-synchronized getMaxLabelCount()I
    .locals 2

    .prologue
    .line 97
    monitor-enter p0

    :try_start_0
    iget-wide v0, p0, Llibcore/icu/AlphabeticIndex;->peer:J

    invoke-static {v0, v1}, Llibcore/icu/AlphabeticIndex;->getMaxLabelCount(J)I
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    move-result v0

    monitor-exit p0

    return v0

    :catchall_0
    move-exception v0

    monitor-exit p0

    throw v0
.end method

.method public declared-synchronized setMaxLabelCount(I)Llibcore/icu/AlphabeticIndex;
    .locals 2
    .param p1, "count"    # I

    .prologue
    .line 105
    monitor-enter p0

    :try_start_0
    iget-wide v0, p0, Llibcore/icu/AlphabeticIndex;->peer:J

    invoke-static {v0, v1, p1}, Llibcore/icu/AlphabeticIndex;->setMaxLabelCount(JI)V
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    .line 106
    monitor-exit p0

    return-object p0

    .line 105
    :catchall_0
    move-exception v0

    monitor-exit p0

    throw v0
.end method


text:
title: Habitat 0.54.0 Released
date: 2018-02-20
author: Tasha Drew
tags: release notes
category: product
classes: body-article
---

Habitat 0.54.0 Release Notes

We are happy to announce the release of Habitat 0.54.0. We have a number of new features as well as bug fixes, so please read on for all the details. If you just want the binaries, head on over to [Install Habitat](https://www.habitat.sh/docs/using-habitat/#install-habitat). Thanks again for using Habitat!

Highlights:

* [BREAKING CHANGE] Updates Kubernetes and Helm exporters for latest Habitat Operator version
* [BUGFIX] Fix array access regression in template rendering
* [BUGFIX] `hab svc load` respects currently-installed software
* [BUGFIX] Download on-demand packages from the `stable` channel
* [FEATURE] Added ability to pass secrets into the Studio

<h2> Updated Kubernetes and Helm exporters for latest Habitat Operator version </h2>

New versions of the Kubernetes and Helm exporters are released. The manifests generated by these versions work with version 0.5 and above of the [Habitat Kubernetes Operator](https://github.com/habitat-sh/habitat-operator), but they will not work with earlier versions.

The Helm exporter now also includes the Habitat Operator in exported charts.

[PR 4627: pkg-export-k8s: Adapt to Habitat Operator API changes](https://github.com/habitat-sh/habitat/pull/4627)
[PR 4628: pkg-export-helm: Depend on Habitat operator chart](https://github.com/habitat-sh/habitat/pull/4628)

<h2> Fix array access regression in template rendering </h2>

A regression in how array accesses are interpreted was introduced through a dependency upgrade in the 0.52.0 release, affecting templates in the form `{{foo[0]}}`. This is now fixed.

[PR 4620: Fix array access regression in template rendering](https://github.com/habitat-sh/habitat/pull/4620)

<h2> `hab svc load` respects currently-installed software </h2>

When starting or loading services, the Supervisor should always look for locally-installed software to run before reaching out to Builder. If a release that satisfies the package identifier given (as with, e.g. `hab svc load core/redis`) is found locally, no contact with Builder will be made.

There was a bug in one code branch of the `hab svc load` logic whereby this _did not_ happen, meaning that the Supervisor would _always_ try to find the software on Builder. This was particularly problematic for users trying to load services that have not been uploaded to Builder.

All start / load code paths should behave consistently now.

[PR 4607: `hab svc load` respects currently-installed software](https://github.com/habitat-sh/habitat/pull/4607)

<h2> Download on-demand packages from the `stable` channel </h2>

We fixed a bug where the "on-demand" downloading of packages was not scoped to a channel. Since the functionality of the `hab` CLI tool is broken out across several Habitat packages, they are downloaded on-demand as they are needed. Due to how we version and release software, though, the impact of the bug was minimal; this fix ensures correctness going forward by strictly downloading only stable releases.

[PR 4565: Download on-demand packages from the `stable` channel](https://github.com/habitat-sh/habitat/pull/4565)

<h2> GitHub API client now honors the HTTPS_PROXY environment variable </h2>

Previously, communication with GitHub ignored any proxies present in the environment, which made communication behind e.g. a corporate firewall impossible. Now, if HTTPS_PROXY is set, it will be used.

[PR 4631: Convert github-api-client to use http-client, which respects proxies](https://github.com/habitat-sh/habitat/pull/4631)

<h2> Load secrets into the studio </h2>

Prior to this change all environment variables were scrubbed out of the studio environment. This was inconvenient when you wanted to pass in keys, passwords etc as part of your build. As of today you will be able to prefix your secret environment variables with `HAB_STUDIO_SECRET` to allow them to pass into the studio. Example:

`HAB_STUDIO_SECRET_SSH_KEY="some secret_key"` will pass into the studio as `SSH_KEY="some secret_key"`

You can see all the documented Environment Variables on our [docs page](https://www.habitat.sh/docs/reference/#environment-variables).

[PR 4573: Added ability to pass habitat secrets into the studio](https://github.com/habitat-sh/habitat/pull/4573)