text:
		By: AtroCty
		Prev. Authors: Firetoad
		Date:  04.08.2015
		Updated:  23.04.2017
	]]

CreateEmptyTalents("sven")

-------------------------------------------
--            STORM BOLT
-------------------------------------------
LinkLuaModifier("modifier_imba_storm_bolt_caster", "hero/hero_sven", LUA_MODIFIER_MOTION_NONE)
LinkLuaModifier("modifier_imba_storm_bolt_crit", "hero/hero_sven", LUA_MODIFIER_MOTION_NONE)

imba_sven_storm_bolt = class({})
function imba_sven_storm_bolt:IsHiddenWhenStolen() return false end
function imba_sven_storm_bolt:IsRefreshable() return true end
function imba_sven_storm_bolt:IsStealable() return true end
function imba_sven_storm_bolt:IsNetherWardStealable() return false end

function imba_sven_storm_bolt:GetAbilityTextureName()
   return "sven_storm_bolt"
end
-------------------------------------------

function imba_sven_storm_bolt:OnSpellStart()
    if IsServer() then
		local caster = self:GetCaster()
		self.target = self:GetCursorTarget()

		-- Parameters
		local damage = self:GetSpecialValueFor("damage")
		local stun_duration = self:GetSpecialValueFor("stun_duration")
		local radius = self:GetTalentSpecialValueFor("radius")
		local vision_radius = self:GetSpecialValueFor("vision_radius")
		local bolt_speed = self:GetSpecialValueFor("bolt_speed")

		-- Play sound
		caster:EmitSound("Hero_Sven.StormBolt")

		-- Randomly play a cast line
		if (math.random(1,100) <= 50) and (caster:GetName() == "npc_dota_hero_sven") then
			caster:EmitSound("sven_sven_ability_stormbolt_0"..math.random(1,9))
		end

		-- Remove caster from the world
		caster:AddNewModifier(caster, self, "modifier_imba_storm_bolt_caster", {})
		caster:AddNoDraw()

		local projectile =
		{
			Target 				= self.target,
			Source 				= caster,
			Ability 			= self,
			EffectName 			= "particles/units/heroes/hero_sven/sven_spell_storm_bolt.vpcf",
			iMoveSpeed			= bolt_speed,
			vSpawnOrigin 		= caster:GetAbsOrigin(),
			bDrawsOnMinimap 	= false,
			bDodgeable 			= true,
			bIsAttack 			= false,
			bVisibleToEnemies 	= true,
			bReplaceExisting 	= false,
			flExpireTime 		= GameRules:GetGameTime() + 10,
			bProvidesVision 	= true,
			iSourceAttachment 	= DOTA_PROJECTILE_ATTACHMENT_ATTACK_2,
			iVisionRadius 		= vision_radius,
			iVisionTeamNumber 	= caster:GetTeamNumber(),
			ExtraData			= {damage = damage, stun_duration = stun_duration, radius = radius}
		}
		ProjectileManager:CreateTrackingProjectile(projectile)
	end
end

function imba_sven_storm_bolt:OnProjectileHit_ExtraData(target, location, ExtraData)
	if IsServer() then
		local caster = self:GetCaster()
		local dummy = CreateUnitByName("npc_dummy_unit", location, false, caster, caster, caster:GetTeamNumber() )

		-- Play sound
		dummy:EmitSound("Hero_Sven.StormBoltImpact")
		dummy:Destroy()
		caster:RemoveModifierByName("modifier_imba_storm_bolt_caster")
		caster:RemoveNoDraw()
		if target then
			-- Teleport the caster to the target
			local target_pos = target:GetAbsOrigin()
			local caster_pos = caster:GetAbsOrigin()
			local blink_pos = target_pos + ( caster_pos - target_pos ):Normalized() * 100
			FindClearSpaceForUnit(caster, blink_pos, true)

			-- Randomly play a cast line
			if (( target_pos - caster_pos ):Length2D() > 600) and (RandomInt(1, 100) <= 20) and (caster:GetName() == "npc_dota_hero_sven") then
				caster:EmitSound("sven_sven_ability_teleport_0"..math.random(1,3))
			end

			-- Start attacking the target + apply crit
			caster:SetAttacking(target)
			local crit_max_duration = self:GetSpecialValueFor("crit_max_duration")
			caster:AddNewModifier(caster, self, "modifier_imba_storm_bolt_crit", {duration = crit_max_duration})

			local enemies = FindUnitsInRadius(caster:GetTeamNumber(), location, nil, ExtraData.radius, self:GetAbilityTargetTeam(), self:GetAbilityTargetType(), self:GetAbilityTargetFlags(), FIND_ANY_ORDER, false)
			for _,enemy in ipairs(enemies) do
				if enemy == target and target:TriggerSpellAbsorb(self) then
				else
					ApplyDamage({victim = enemy, attacker = caster, ability = self, damage = ExtraData.damage, damage_type = self:GetAbilityDamageType()})
					enemy:AddNewModifier(caster, self, "modifier_stunned", {duration = ExtraData.stun_duration})
				end
			end
		end
	end
end

function imba_sven_storm_bolt:GetAOERadius()
	return self:GetTalentSpecialValueFor("radius")
end

function imba_sven_storm_bolt:GetCooldown( nLevel )
	return self.BaseClass.GetCooldown( self, nLevel ) - self:GetCaster():FindTalentValue("special_bonus_imba_sven_5")
end

-------------------------------------------
modifier_imba_storm_bolt_caster = class({})
function modifier_imba_storm_bolt_caster:IsDebuff() return true end
function modifier_imba_storm_bolt_caster:IsHidden() return true end
function modifier_imba_storm_bolt_caster:IsPurgable() return false end
function modifier_imba_storm_bolt_caster:IsPurgeException() return false end
function modifier_imba_storm_bolt_caster:IsStunDebuff() return false end
function modifier_imba_storm_bolt_caster:RemoveOnDeath() return true end
-------------------------------------------

function modifier_imba_storm_bolt_caster:CheckState()
	local state =
	{
		[MODIFIER_STATE_STUNNED] = true,
		[MODIFIER_STATE_OUT_OF_GAME] = true,
		[MODIFIER_STATE_INVULNERABLE] = true,
		[MODIFIER_STATE_NO_HEALTH_BAR] = true,
	}
	return state
end

-------------------------------------------
modifier_imba_storm_bolt_crit = class({})
function modifier_imba_storm_bolt_crit:IsDebuff() return false end
function modifier_imba_storm_bolt_crit:IsHidden() return false end
function modifier_imba_storm_bolt_crit:IsPurgable() return false end
function modifier_imba_storm_bolt_crit:IsPurgeException() return true end
function modifier_imba_storm_bolt_crit:IsStunDebuff() return false end
function modifier_imba_storm_bolt_crit:RemoveOnDeath() return true end
-------------------------------------------

function modifier_imba_storm_bolt_crit:DeclareFunctions()
    local decFuns =
    {
		MODIFIER_EVENT_ON_ATTACK_LANDED,
		MODIFIER_PROPERTY_PREATTACK_CRITICALSTRIKE
    }
    return decFuns
end

function modifier_imba_storm_bolt_crit:OnAttackLanded( params )
	if IsServer() then
		-- Destroy after first attack
		if self:GetParent() == params.attacker then
			self:Destroy()
		end
	end
end

function modifier_imba_storm_bolt_crit:GetModifierPreAttack_CriticalStrike( params )
	if self:GetAbility().target == params.target then
		return self:GetAbility():GetSpecialValueFor("crit_pct")
	else
		return nil
	end
end

-------------------------------------------
-- 				GREAT CLEAVE
-------------------------------------------
LinkLuaModifier("modifier_imba_great_cleave", "hero/hero_sven", LUA_MODIFIER_MOTION_NONE)
LinkLuaModifier("modifier_imba_great_cleave_active", "hero/hero_sven", LUA_MODIFIER_MOTION_NONE)

imba_sven_great_cleave = class({})
function imba_sven_great_cleave:IsHiddenWhenStolen() return false end
function imba_sven_great_cleave:IsRefreshable() return true end
function imba_sven_great_cleave:IsStealable() return true end
function imba_sven_great_cleave:IsNetherWardStealable() return false end

function imba_sven_great_cleave:GetAbilityTextureName()
   return "sven_great_cleave"
end
-------------------------------------------

function imba_sven_great_cleave:GetIntrinsicModifierName()
    return "modifier_imba_great_cleave"
end

function imba_sven_great_cleave:OnSpellStart()
	if IsServer() then
		local caster = self:GetCaster()
		caster:AddNewModifier(caster, self, "modifier_imba_great_cleave_active", {duration = 5})
	end
end

-------------------------------------------
modifier_imba_great_cleave = class({})
function modifier_imba_great_cleave:IsDebuff() return false end
function modifier_imba_great_cleave:IsHidden() return true end
function modifier_imba_great_cleave:IsPurgable() return false end
function modifier_imba_great_cleave:IsPurgeException() return false end
function modifier_imba_great_cleave:IsStunDebuff() return false end
function modifier_imba_great_cleave:RemoveOnDeath() return true end
-------------------------------------------

function modifier_imba_great_cleave:DeclareFunctions()
	local decFuncs =
	{
		MODIFIER_EVENT_ON_ATTACK_LANDED
	}
	return decFuncs
end

function modifier_imba_great_cleave:OnAttackLanded( params )
	if IsServer() then
		local caster = self:GetCaster()
		local ability = self:GetAbility()
		if (params.attacker == caster) and caster:IsRealHero() and (params.target:GetTeamNumber() ~= caster:GetTeamNumber()) and (not caster:HasModifier("modifier_imba_great_cleave_active")) and not caster:PassivesDisabled() then
			local cleave_particle = "particles/units/heroes/hero_sven/sven_spell_great_cleave.vpcf"
			local cleave_damage_pct = ability:GetSpecialValueFor("great_cleave_damage") / 100
			local cleave_radius_start = ability:GetSpecialValueFor("cleave_starting_width")
			local cleave_radius_end = ability:GetTalentSpecialValueFor("cleave_ending_width")
			local cleave_distance = ability:GetTalentSpecialValueFor("cleave_distance")
			DoCleaveAttack( params.attacker, params.target, ability, (params.damage * cleave_damage_pct), cleave_radius_start, cleave_radius_end, cleave_distance, cleave_particle )
		end
	end
end

-------------------------------------------
modifier_imba_great_cleave_active = class({})
function modifier_imba_great_cleave_active:IsDebuff() return false end
function modifier_imba_great_cleave_active:IsHidden() return false end
function modifier_imba_great_cleave_active:IsPurgable() return false end
function modifier_imba_great_cleave_active:IsPurgeException() return false end
function modifier_imba_great_cleave_active:IsStunDebuff() return false end
function modifier_imba_great_cleave_active:RemoveOnDeath() return true end
-------------------------------------------

function modifier_imba_great_cleave_active:DeclareFunctions()
	local decFuncs =
	{
		MODIFIER_PROPERTY_TRANSLATE_ACTIVITY_MODIFIERS,
		MODIFIER_PROPERTY_TOTALDAMAGEOUTGOING_PERCENTAGE
	}
	return decFuncs
end

function modifier_imba_great_cleave_active:GetActivityTranslationModifiers()
	if self:GetParent():GetName() == "npc_dota_hero_sven" then
		return "fear"
	end
	return 0
end

function modifier_imba_great_cleave_active:CheckState()
	local state =
	{
		[MODIFIER_STATE_CANNOT_MISS] = true
	}
	return state
end

function modifier_imba_great_cleave_active:GetModifierTotalDamageOutgoing_Percentage( params )
	if IsServer() then
		if params.target and not params.inflictor then
			local armor = params.target:GetPhysicalArmorValue()
			local armor_ignore = self:GetAbility():GetTalentSpecialValueFor("armor_ignore")
			local reduction_feedback
			if armor < 0 then
				return 0
			elseif armor <= armor_ignore then
				reduction_feedback = CalculateReductionFromArmor_Percentage( 0, armor )

			else
				reduction_feedback = CalculateReductionFromArmor_Percentage( (armor - armor_ignore), armor )
			end
			reduction_feedback = reduction_feedback * (1 + ( reduction_feedback / 100))
			return reduction_feedback
		end
		return 0
	end
end

function modifier_imba_great_cleave_active:OnCreated()
	local parent = self:GetParent()
	local fire_fx = ParticleManager:CreateParticle("particles/hero/sven/great_cleave_glow_base.vpcf", PATTACH_ABSORIGIN, parent)
	ParticleManager:SetParticleControlEnt(fire_fx, 0, parent, PATTACH_POINT_FOLLOW, "attach_weapon", parent:GetAbsOrigin(), true)
	self:AddParticle(fire_fx, false, false, -1, false, false)
end

-------------------------------------------
--            WARCRY
-------------------------------------------
LinkLuaModifier("modifier_imba_warcry", "hero/hero_sven", LUA_MODIFIER_MOTION_NONE)
LinkLuaModifier("modifier_imba_warcry_immunity", "hero/hero_sven", LUA_MODIFIER_MOTION_NONE)

imba_sven_warcry = class({})
function imba_sven_warcry:IsHiddenWhenStolen() return false end
function imba_sven_warcry:IsRefreshable() return true end
function imba_sven_warcry:IsStealable() return true end
function imba_sven_warcry:IsPurgable() return true end
function imba_sven_warcry:IsNetherWardStealable() return true end

function imba_sven_warcry:GetAbilityTextureName()
   return "sven_warcry"
end
-------------------------------------------

function imba_sven_warcry:OnSpellStart()
	if IsServer() then
		local caster = self:GetCaster()
		-- Parameters
		local ms_bonus_pct = self:GetTalentSpecialValueFor("ms_bonus_pct")
		local armor_bonus = self:GetSpecialValueFor("armor_bonus")
		local tenacity_bonus_pct = self:GetSpecialValueFor("tenacity_bonus_pct")
		local tenacity_self_pct = self:GetSpecialValueFor("tenacity_self_pct")
		local radius = self:GetSpecialValueFor("radius")
		local duration = self:GetSpecialValueFor("duration")

		local allies = FindUnitsInRadius(caster:GetTeamNumber(), caster:GetAbsOrigin(), nil, radius, self:GetAbilityTargetTeam(), self:GetAbilityTargetType(), self:GetAbilityTargetFlags(), FIND_ANY_ORDER, false)
		for _,ally in ipairs(allies) do
			if caster == ally then
				caster:AddNewModifier(caster, self, "modifier_imba_warcry", {duration = duration})
				if caster:HasTalent("special_bonus_imba_sven_7") then
					caster:AddNewModifier(caster, self, "modifier_imba_warcry_immunity", {duration = caster:FindTalentValue("special_bonus_imba_sven_7")})
				end
			else
				ally:AddNewModifier(caster, self, "modifier_imba_warcry", {duration = duration})
			end
		end
		caster:StartGesture(ACT_DOTA_OVERRIDE_ABILITY_3)
		caster:Purge(false,true,false,false,false)
	end
end

function imba_sven_warcry:GetCastRange( location , target)
	return self:GetSpecialValueFor("radius")
end

-------------------------------------------
modifier_imba_warcry = class({})
function modifier_imba_warcry:IsDebuff() return false end
function modifier_imba_warcry:IsHidden() return false end
function modifier_imba_warcry:IsPurgable() return true end
function modifier_imba_warcry:IsStunDebuff() return false end
function modifier_imba_warcry:RemoveOnDeath() return true end
-------------------------------------------

function modifier_imba_warcry:DeclareFunctions()
    local decFuns =
    {
		MODIFIER_PROPERTY_MOVESPEED_BONUS_PERCENTAGE,
		MODIFIER_PROPERTY_PHYSICAL_ARMOR_BONUS,
		MODIFIER_PROPERTY_TRANSLATE_ACTIVITY_MODIFIERS
    }
    return decFuns
end

function modifier_imba_warcry:GetActivityTranslationModifiers()
	if self:GetParent():GetName() == "npc_dota_hero_sven" then
		return "sven_warcry"
	end
	return 0
end

function modifier_imba_warcry:OnCreated()
	local ability = self:GetAbility()
	local caster = self:GetCaster()
	local parent = self:GetParent()

	self.ms_bonus_pct = ability:GetTalentSpecialValueFor("ms_bonus_pct")
	self.armor_bonus = ability:GetSpecialValueFor("armor_bonus")
	if parent == caster then
		if IsServer() then
			caster:EmitSound("Hero_Sven.WarCry")
			if caster:GetName() == "npc_dota_hero_sven" then
				caster:EmitSound("sven_sven_ability_warcry_0"..math.random(1,6))
			end
		end
		local caster_loc = caster:GetAbsOrigin()
		self.tenacity_pct = ability:GetSpecialValueFor("tenacity_self_pct")
		if self.cast_fx then
			ParticleManager:DestroyParticle(self.cast_fx, false)
			ParticleManager:ReleaseParticleIndex(self.cast_fx)
		end
		self.cast_fx = ParticleManager:CreateParticle("particles/units/heroes/hero_sven/sven_spell_warcry.vpcf", PATTACH_ABSORIGIN_FOLLOW, caster)
		ParticleManager:SetParticleControlEnt(self.cast_fx, 0, caster, PATTACH_POINT_FOLLOW, nil, caster_loc, true)
		ParticleManager:SetParticleControlEnt(self.cast_fx, 1, caster, PATTACH_POINT_FOLLOW, nil, caster_loc, true)
		ParticleManager:SetParticleControlEnt(self.cast_fx, 2, caster, PATTACH_POINT_FOLLOW, nil, caster_loc, true)
		ParticleManager:SetParticleControlEnt(self.cast_fx, 4, caster, PATTACH_POINT_FOLLOW, nil, caster_loc, true)
		self:AddParticle(self.cast_fx, false, false, -1, false, false)
	else
		self.tenacity_pct = ability:GetSpecialValueFor("tenacity_bonus_pct")
	end
	if self.buff_fx then
		ParticleManager:DestroyParticle(self.buff_fx, false)
		ParticleManager:ReleaseParticleIndex(self.buff_fx)
	end
	self.buff_fx = ParticleManager:CreateParticle("particles/units/heroes/hero_sven/sven_warcry_buff.vpcf", PATTACH_ABSORIGIN_FOLLOW, caster)
	ParticleManager:SetParticleControlEnt(self.buff_fx, 0, parent, PATTACH_POINT_FOLLOW, nil, parent:GetAbsOrigin(), true)
	ParticleManager:SetParticleControlEnt(self.buff_fx, 1, parent, PATTACH_OVERHEAD_FOLLOW, nil, parent:GetAbsOrigin(), true)
	self:AddParticle(self.buff_fx, false, false, -1, false, false)
end

function modifier_imba_warcry:OnRefresh()
	self:OnCreated()
end

function modifier_imba_warcry:GetCustomTenacity()
	return self.tenacity_pct
end

function modifier_imba_warcry:GetModifierMoveSpeedBonus_Percentage()
	return self.ms_bonus_pct
end

function modifier_imba_warcry:GetModifierPhysicalArmorBonus()
	return self.armor_bonus
end

-------------------------------------------
modifier_imba_warcry_immunity = class({})
function modifier_imba_warcry_immunity:IsDebuff() return false end
function modifier_imba_warcry_immunity:IsHidden() return false end
function modifier_imba_warcry_immunity:IsPurgable() return true end
function modifier_imba_warcry_immunity:IsStunDebuff() return false end
function modifier_imba_warcry_immunity:RemoveOnDeath() return true end
-------------------------------------------
function modifier_imba_warcry_immunity:CheckState()
	local state =
	{
		[MODIFIER_STATE_MAGIC_IMMUNE] = true
	}
	return state
end

function modifier_imba_warcry_immunity:GetEffectName()
	return "particles/items_fx/black_king_bar_avatar.vpcf"
end

function modifier_imba_warcry_immunity:GetEffectAttachType()
	return PATTACH_POINT_FOLLOW
end

-------------------------------------------
--			GOD'S STRENGTH
-------------------------------------------
LinkLuaModifier("modifier_imba_god_strength", "hero/hero_sven", LUA_MODIFIER_MOTION_NONE)
LinkLuaModifier("modifier_imba_god_strength_allies", "hero/hero_sven", LUA_MODIFIER_MOTION_NONE)

imba_sven_gods_strength = class({})
function imba_sven_gods_strength:IsHiddenWhenStolen() return false end
function imba_sven_gods_strength:IsRefreshable() return true end
function imba_sven_gods_strength:IsStealable() return true end
function imba_sven_gods_strength:IsNetherWardStealable() return false end

function imba_sven_gods_strength:GetAbilityTextureName()
   return "sven_gods_strength"
end
-------------------------------------------
function imba_sven_gods_strength:GetCooldown( nLevel )
	return self.BaseClass.GetCooldown( self, nLevel ) - self:GetCaster():FindTalentValue("special_bonus_imba_sven_4")
end

function imba_sven_gods_strength:GetAssociatedSecondaryAbilities()
	return "imba_sven_colossal_slash"
end

function imba_sven_gods_strength:OnUpgrade()
	if IsServer() then
		local caster = self:GetCaster()
		local ability_slash = caster:FindAbilityByName(self:GetAssociatedSecondaryAbilities())
		ability_slash:SetLevel(self:GetLevel())
		if not caster:HasModifier("modifier_imba_god_strength") then
			ability_slash:SetActivated(false)
		end
	end
end

function imba_sven_gods_strength:OnSpellStart()
	if IsServer() then
		local caster = self:GetCaster()
		local duration = self:GetSpecialValueFor("duration")
		caster:AddNewModifier(caster, self, "modifier_imba_god_strength", {duration = duration})
		caster:EmitSound("Hero_Sven.GodsStrength")
		if (math.random(1,100) <= 25) then
			caster:EmitSound("Imba.SvenBeAMan")
		end
		caster:StartGesture(ACT_DOTA_OVERRIDE_ABILITY_4)

		local roar_pfx = ParticleManager:CreateParticle("particles/units/heroes/hero_sven/sven_spell_gods_strength.vpcf", PATTACH_ABSORIGIN_FOLLOW, caster)
		ParticleManager:SetParticleControlEnt(roar_pfx, 1, caster, PATTACH_ABSORIGIN_FOLLOW, nil, caster:GetAbsOrigin(), true)
		ParticleManager:ReleaseParticleIndex(roar_pfx)
	end
end
-------------------------------------------
modifier_imba_god_strength = class({})
function modifier_imba_god_strength:IsDebuff() return false end
function modifier_imba_god_strength:IsHidden() return false end
function modifier_imba_god_strength:IsPurgable() return false end
function modifier_imba_god_strength:IsPurgeException() return false end
function modifier_imba_god_strength:IsStunDebuff() return false end
function modifier_imba_god_strength:RemoveOnDeath() return true end
-------------------------------------------

function modifier_imba_god_strength:IsAura()
	if IsServer() then
		return self:GetCaster():HasScepter()
	end
	return false
end

function modifier_imba_god_strength:GetAttackSound()
	return "Hero_Sven.GodsStrength.Attack"
end

function modifier_imba_god_strength:DeclareFunctions()
	local decFuncs =
	{
		MODIFIER_PROPERTY_BASEDAMAGEOUTGOING_PERCENTAGE,
		MODIFIER_PROPERTY_TRANSLATE_ATTACK_SOUND
	}
	return decFuncs
end

function modifier_imba_god_strength:GetHeroEffectName()
	return "particles/units/heroes/hero_sven/sven_gods_strength_hero_effect.vpcf"
end

function modifier_imba_god_strength:HeroEffectPriority()
	return 10
end

function modifier_imba_god_strength:GetStatusEffectName()
	return "particles/status_fx/status_effect_gods_strength.vpcf"
end

function modifier_imba_god_strength:StatusEffectPriority()
	return 10
end

function modifier_imba_god_strength:GetAuraSearchTeam()
	return self:GetAbility():GetAbilityTargetTeam()
end

function modifier_imba_god_strength:GetAuraSearchType()
	return self:GetAbility():GetAbilityTargetType()
end

function modifier_imba_god_strength:GetModifierAura()
	return "modifier_imba_god_strength_allies"
end

function modifier_imba_god_strength:GetAuraSearchFlags()
	return self:GetAbility():GetAbilityTargetFlags()
end

function modifier_imba_god_strength:GetAuraRadius()
	return self.aura_radius_scepter
end

function modifier_imba_god_strength:GetAuraEntityReject( target )
	if IsServer() then
		if self:GetParent() == target then
			return true
		end
	end
	return false
end

function modifier_imba_god_strength:GetModifierBaseDamageOutgoing_Percentage()
	return self.bonus_dmg_pct
end

function modifier_imba_god_strength:OnCreated()
	self.bonus_dmg_pct = self:GetAbility():GetTalentSpecialValueFor("bonus_dmg_pct")
	self.aura_radius_scepter = self:GetAbility():GetSpecialValueFor("aura_radius_scepter")

	if IsServer() then
		local nFXIndex = ParticleManager:CreateParticle( "particles/units/heroes/hero_sven/sven_spell_gods_strength_ambient.vpcf", PATTACH_ABSORIGIN_FOLLOW, self:GetParent() )
		ParticleManager:SetParticleControlEnt( nFXIndex, 0, self:GetParent(), PATTACH_POINT_FOLLOW, "attach_weapon" , self:GetParent():GetOrigin(), true )
		ParticleManager:SetParticleControlEnt( nFXIndex, 2, self:GetParent(), PATTACH_POINT_FOLLOW, "attach_head" , self:GetParent():GetOrigin(), true )
		self:AddParticle( nFXIndex, false, false, -1, false, true )
		self:GetCaster():FindAbilityByName("imba_sven_colossal_slash"):SetActivated(true)
	end
end

function modifier_imba_god_strength:OnRefresh()
	self.bonus_dmg_pct = self:GetAbility():GetSpecialValueFor("gods_strength_damage")
	self.aura_radius_scepter = self:GetAbility():GetSpecialValueFor("aura_radius_scepter")
end

function modifier_imba_god_strength:OnDestroy()
	if IsServer() then
		self:GetCaster():FindAbilityByName("imba_sven_colossal_slash"):SetActivated(false)
	end
end

-------------------------------------------
modifier_imba_god_strength_allies = class({})
function modifier_imba_god_strength_allies:IsDebuff() return false end
function modifier_imba_god_strength_allies:IsHidden() return false end
function modifier_imba_god_strength_allies:IsPurgable() return false end
function modifier_imba_god_strength_allies:IsPurgeException() return false end
function modifier_imba_god_strength_allies:IsStunDebuff() return false end
function modifier_imba_god_strength_allies:RemoveOnDeath() return true end
-------------------------------------------
function modifier_imba_god_strength_allies:GetModifierBaseDamageOutgoing_Percentage()
	return self.bonus_dmg_pct
end

function modifier_imba_god_strength_allies:OnCreated()
	self.bonus_dmg_pct = self:GetAbility():GetSpecialValueFor("ally_bonus_dmg_pct_scepter")
end

function modifier_imba_god_strength_allies:OnRefresh()
	self:OnCreated()
end

function modifier_imba_god_strength_allies:DeclareFunctions()
	local decFuncs =
	{
		MODIFIER_PROPERTY_BASEDAMAGEOUTGOING_PERCENTAGE,
	}
	return decFuncs
end
-------------------------------------------
--			COLOSSAL SLASH
-------------------------------------------
LinkLuaModifier("modifier_imba_colossal_slash_animation", "hero/hero_sven", LUA_MODIFIER_MOTION_NONE)
LinkLuaModifier("modifier_imba_colossal_slash_crit", "hero/hero_sven", LUA_MODIFIER_MOTION_NONE)
imba_sven_colossal_slash = class({})
function imba_sven_colossal_slash:IsHiddenWhenStolen() return false end
function imba_sven_colossal_slash:IsRefreshable() return true end
function imba_sven_colossal_slash:IsStealable() return true end
function imba_sven_colossal_slash:IsNetherWardStealable() return false end

function imba_sven_colossal_slash:GetAbilityTextureName()
   return "custom/sven_colossal_strike"
end
-------------------------------------------

function imba_sven_colossal_slash:GetAssociatedPrimaryAbilities()
	return "imba_sven_gods_strength"
end

function imba_sven_colossal_slash:OnAbilityPhaseStart()
	local caster = self:GetCaster()
	self.animation = true
	local roar_pfx = ParticleManager:CreateParticle("particles/units/heroes/hero_sven/sven_spell_gods_strength.vpcf", PATTACH_ABSORIGIN_FOLLOW, caster)
	ParticleManager:SetParticleControlEnt(roar_pfx, 1, caster, PATTACH_ABSORIGIN_FOLLOW, nil, caster:GetAbsOrigin(), true)
	ParticleManager:ReleaseParticleIndex(roar_pfx)

	if caster:GetName() == "npc_dota_hero_sven" then
		-- Randomly play a cast line
		if (math.random(1,100) <= 25) then
			self.sound = "Imba.SvenGetsugaTensho"
		else
			self.sound = "sven_sven_ability_godstrength_0"..math.random(1,2)
		end
		caster:EmitSound(self.sound)
		self.swing_fx = ParticleManager:CreateParticle("particles/hero/sven/colossal_slash_cast.vpcf", PATTACH_CUSTOMORIGIN_FOLLOW, caster)
		local swing_fx = self.swing_fx
		ParticleManager:SetParticleControlEnt(self.swing_fx, 0, caster, PATTACH_POINT_FOLLOW, "attach_sword", caster:GetAbsOrigin(), true)
		ParticleManager:SetParticleControlEnt(self.swing_fx, 1, caster, PATTACH_POINT_FOLLOW, "attach_sword", caster:GetAbsOrigin(), true)
		Timers:CreateTimer(self:GetBackswingTime(), function()
			ParticleManager:DestroyParticle(swing_fx, false)
			ParticleManager:ReleaseParticleIndex(swing_fx)
		end)
		caster:FadeGesture(ACT_DOTA_OVERRIDE_ABILITY_3)
		caster:FadeGesture(ACT_DOTA_OVERRIDE_ABILITY_4)
		caster:StartGestureWithPlaybackRate(ACT_DOTA_VICTORY,3)
		Timers:CreateTimer(0.4, function()
			if self.animation then
				local mod = caster:AddNewModifier(caster, self, "modifier_imba_colossal_slash_animation", {})
				caster:FadeGesture(ACT_DOTA_VICTORY)
				caster:StartGestureWithPlaybackRate(ACT_DOTA_SPAWN,1.4)
				Timers:CreateTimer(FrameTime(), function()
					mod:Destroy()
				end)
			end
		end)
	end
	return true
end

function imba_sven_colossal_slash:OnAbilityPhaseInterrupted()
	if IsServer() then
		local caster = self:GetCaster()
		caster:FadeGesture(ACT_DOTA_VICTORY)
		caster:FadeGesture(ACT_DOTA_SPAWN)
		self.animation = false
		if self.sound then
			caster:StopSound(self.sound)
		end
		ParticleManager:DestroyParticle(self.swing_fx, false)
		return true
	end
end

function imba_sven_colossal_slash:OnSpellStart()
	if IsServer() then
		local caster = self:GetCaster()
		local target_loc = self:GetCursorPosition()
		local caster_loc = caster:GetAbsOrigin()

		-- Parameters
		local proj_speed = self:GetSpecialValueFor("proj_speed")
		local radius = self:GetSpecialValueFor("radius")
		local crit_bonus_pct = self:GetSpecialValueFor("crit_bonus_pct")
		local base_range = self:GetSpecialValueFor("base_range")
		local range_multiplier = self:GetSpecialValueFor("range_multiplier")
		local direction = (target_loc - caster_loc):Normalized()

		local modifier = caster:FindModifierByName("modifier_imba_god_strength")
		ScreenShake(caster_loc, 10, 0.3, 0.5, 1000, 0, true)
		local remaining_time = 0
		if modifier then
			remaining_time = modifier:GetRemainingTime()
			modifier:Destroy()
		end

		local total_range = base_range + (remaining_time * range_multiplier)

		local caster_pfx = ParticleManager:CreateParticle("particles/units/heroes/hero_earth_spirit/espirit_spawn_ground.vpcf", PATTACH_ABSORIGIN, caster)
		ParticleManager:SetParticleControl(caster_pfx, 0, (caster:GetAbsOrigin() + direction*100))

		-- Launch projectile
		local projectile =
		{
			Ability				= self,
			EffectName			= "particles/hero/sven/colossal_slash.vpcf",
			vSpawnOrigin		= caster_loc,
			fDistance			= total_range,
			fStartRadius		= radius,
			fEndRadius			= radius,
			Source				= caster,
			bHasFrontalCone		= false,
			bReplaceExisting	= false,
			iUnitTargetTeam		= DOTA_UNIT_TARGET_TEAM_ENEMY,
			iUnitTargetType		= DOTA_UNIT_TARGET_HERO + DOTA_UNIT_TARGET_BASIC,
			fExpireTime 		= GameRules:GetGameTime() + 5.0,
			bDeleteOnHit		= false,
			vVelocity			= Vector(direction.x,direction.y,0) * proj_speed,
			bProvidesVision		= true,
			iVisionRadius 		= radius,
			iVisionTeamNumber 	= caster:GetTeamNumber()
		}
		ProjectileManager:CreateLinearProjectile(projectile)
		-- Create sound dummy
		local dummy = CreateUnitByName("npc_dummy_unit", caster_loc, false, caster, caster, caster:GetTeamNumber() )
		EmitSoundOn("Imba.SvenShockWave",dummy)
		local current_distance = 0
		local rate = 0.3
		-- Provide vision along the projectile's path
		Timers:CreateTimer(0, function()
			local location = caster_loc + direction * current_distance
			dummy:SetAbsOrigin(location)
			current_distance = current_distance + (proj_speed * rate)
			if current_distance < total_range then
				return rate
			end
		end)
		Timers:CreateTimer(3, function()
			dummy:Destroy()
		end)
	end
end

function imba_sven_colossal_slash:OnProjectileHit(target, location)
	if target then
		local caster = self:GetCaster()
		local mod = caster:AddNewModifier(caster, self, "modifier_imba_colossal_slash_crit", {})
		caster:PerformAttack(target, true, false, true, true, true, false, true)
		mod:Destroy()
	end
end
-------------------------------------------
modifier_imba_colossal_slash_crit = class({})
function modifier_imba_colossal_slash_crit:IsDebuff() return false end
function modifier_imba_colossal_slash_crit:IsHidden() return true end
function modifier_imba_colossal_slash_crit:IsPurgable() return false end
function modifier_imba_colossal_slash_crit:IsPurgeException() return false end
function modifier_imba_colossal_slash_crit:IsStunDebuff() return false end
function modifier_imba_colossal_slash_crit:RemoveOnDeath() return true end
-------------------------------------------
function modifier_imba_colossal_slash_crit:DeclareFunctions()
	local decFuncs =
	{
		MODIFIER_PROPERTY_BASEDAMAGEOUTGOING_PERCENTAGE,
		MODIFIER_PROPERTY_TOTALDAMAGEOUTGOING_PERCENTAGE,
		MODIFIER_PROPERTY_TRANSLATE_ATTACK_SOUND,
	}
	return decFuncs
end

function modifier_imba_colossal_slash_crit:GetAttackSound()
	return "Hero_Sven.GodsStrength.Attack"
end

function modifier_imba_colossal_slash_crit:OnCreated()
	self.crit_bonus_pct = self:GetAbility():GetSpecialValueFor("crit_bonus_pct") - 100
	if self:GetCaster():HasModifier("modifier_imba_god_strength") then
		self.bonus_dmg_pct = 0
	else
		self.bonus_dmg_pct = self:GetAbility():GetTalentSpecialValueFor("bonus_dmg_pct")
	end
end

function modifier_imba_colossal_slash_crit:GetModifierBaseDamageOutgoing_Percentage()
	return self.bonus_dmg_pct
end

function modifier_imba_colossal_slash_crit:GetModifierTotalDamageOutgoing_Percentage(params)
	local damage = params.damage + (params.damage * self.crit_bonus_pct / 100)
	SendOverheadEventMessage(nil, OVERHEAD_ALERT_CRITICAL, params.target, damage, nil)
	return self.crit_bonus_pct
end

-------------------------------------------
modifier_imba_colossal_slash_animation = class({})
function modifier_imba_colossal_slash_animation:IsDebuff() return false end
function modifier_imba_colossal_slash_animation:IsHidden() return false end
function modifier_imba_colossal_slash_animation:IsPurgable() return false end
function modifier_imba_colossal_slash_animation:IsPurgeException() return false end
function modifier_imba_colossal_slash_animation:IsStunDebuff() return false end
function modifier_imba_colossal_slash_animation:RemoveOnDeath() return true end
-------------------------------------------

function modifier_imba_colossal_slash_animation:DeclareFunctions()
    local decFuns =
    {
        MODIFIER_PROPERTY_TRANSLATE_ACTIVITY_MODIFIERS,
    }
    return decFuns
end

function modifier_imba_colossal_slash_animation:GetActivityTranslationModifiers()
	if self:GetParent():GetName() == "npc_dota_hero_sven" then
		return "loadout"
	end
	return 0
end


text:
package org.bds.executioner;

import java.util.List;
import java.util.regex.Pattern;

import org.bds.Config;
import org.bds.cluster.host.HostResources;
import org.bds.task.Task;
import org.bds.util.Timer;

/**
 * Execute tasks in an SGE cluster.
 *
 * @author pcingola
 */
public class ExecutionerClusterSge extends ExecutionerCluster {

	public static final String PID_REGEX_DEFAULT = "Your job (\\S+)";

	String sgePe = "", sgeMem = "", sgeTimeOut = "", sgeTimeOut2 = "";

	public ExecutionerClusterSge(Config config) {
		super(config);

		// Postmortem needs "-j"
		String postMortemInfoCommand[] = { "qstat", "-f", "-j" };
		clusterPostMortemInfoCommand = postMortemInfoCommand;

		// When running qsub you get a line lie this:
		//
		//		$ echo ls | qsub
		// 		Your job 33 ("STDIN") has been submitted
		//
		// So, this is a pattern matcher to parse the PID
		pidRegexStr = config.getPidRegex(PID_REGEX_DEFAULT);
		pidRegex = Pattern.compile(pidRegexStr);
		if (debug) log("Using pidRegex '" + pidRegexStr + "'");

		// SGE parameters from config file
		sgePe = config.getString(Config.CLUSTER_SGE_PE, "");
		if (sgePe.isEmpty()) throw new RuntimeException("Missing config file entry '" + Config.CLUSTER_SGE_PE + "'.");

		sgeMem = config.getString(Config.CLUSTER_SGE_MEM, "");
		if (sgeMem.isEmpty()) throw new RuntimeException("Missing config file entry '" + Config.CLUSTER_SGE_MEM + "'.");

		sgeTimeOut = config.getString(Config.CLUSTER_SGE_TIMEOUT, "");
		if (sgeTimeOut.isEmpty()) throw new RuntimeException("Missing config file entry '" + Config.CLUSTER_SGE_TIMEOUT + "'.");

		sgeTimeOut2 = config.getString(Config.CLUSTER_SGE_TIMEOUT2, "");
	}

	/**
	 * Add resource options to command line parameters
	 */
	@Override
	protected void addResources(Task task, List<String> args) {
		// Add resources request
		HostResources res = task.getResources();

		// Cpu
		if (res.getCpus() > 0) {
			args.add("-pe");
			args.add(sgePe);
			args.add("" + res.getCpus());
		}

		// Memory
		if (res.getMem() > 0) {
			if (sgeMem.isEmpty()) throw new RuntimeException("Missing config file entry '" + Config.CLUSTER_SGE_PE + "'.");
			args.add("-l");
			args.add(sgeMem + "=" + res.getMem());
		}

		// Timeout
		int clusterTimeout = calcTimeOut(res);
		if (clusterTimeout > 0) {
			args.add("-l");
			args.add(sgeTimeOut + "=" + Timer.toHHMMSS(clusterTimeout * 1000));

			if ( !sgeTimeOut2.isEmpty() ) {
				args.add("-l");
				args.add(sgeTimeOut2 + "=" + Timer.toHHMMSS(clusterTimeout * 1000));
			}
		}

		// A particular queue was requested?
		String queue = task.getQueue();
		if (queue != null && !queue.isEmpty()) {
			args.add("-q");
			args.add(queue);
		}
	}
}

redpajama_set_name: RedPajamaGithub


text:
<?php
namespace AcMailer\Options\Factory;

use AcMailer\Factory\AbstractAcMailerFactory;
use AcMailer\Options\MailOptions;
use Zend\ServiceManager\AbstractFactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;
use Zend\Stdlib\ArrayUtils;
use Zend\Stdlib\ErrorHandler;

/**
 * Class MailOptionsAbstractFactory
 * @author Alejandro Celaya Alastrué
 * @link http://www.alejandrocelaya.com
 */
class MailOptionsAbstractFactory extends AbstractAcMailerFactory
{
    const SPECIFIC_PART = 'mailoptions';

    /**
     * Create service with name
     *
     * @param ServiceLocatorInterface $serviceLocator
     * @param $name
     * @param $requestedName
     * @return mixed
     */
    public function createServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName)
    {
        $specificServiceName = explode('.', $name)[2];
        $config = $this->getConfig($serviceLocator);
        $specificConfig = $config[$specificServiceName];
        if (! is_array($specificConfig)) {
            $specificConfig = [];
        }

        // Try to extend from another configuration if defined and exists
        if (isset($specificConfig['extends']) && is_string($specificConfig['extends'])) {
            $extendsConfigKey = trim($specificConfig['extends']);
            if (array_key_exists($extendsConfigKey, $config) && is_array($config[$extendsConfigKey])) {
                $specificConfig = ArrayUtils::merge($config[$extendsConfigKey], $specificConfig);
            }

            unset($specificConfig['extends']);
        }

        return new MailOptions($specificConfig);
    }
}


text:
package in.ksharma.weblayout.layout;

import org.apache.log4j.Layout;
import org.apache.log4j.spi.LoggingEvent;

/**
 * Layout that does no formatting. Simply returns a string representation of the
 * object.
 *
 * @author Kshitiz Sharma
 */
/*
 * TODO why do we need it? Why do we have a single layout for preparing all the
 * output? Why can't we split the responsibility between multiple classes?
 */
public class PlainLayout extends Layout {

	@Override
	public void activateOptions() {
	}

	@Override
	public String format(LoggingEvent event) {
		return event.getMessage().toString();
	}

	@Override
	public boolean ignoresThrowable() {
		// Tell appender not to print the throwable. This layout would take care
		// of it.
		return false;
	}
}


text:
package org.scalajs.junit

import org.junit.Assume._
import org.junit.Test

import org.scalajs.junit.utils.JUnitTest

class MultiAssumeFail1Test {
  @Test def multiTest1(): Unit = {
    assumeTrue("This assume should not pass", false)
  }

  @Test def multiTest2(): Unit = ()
  @Test def multiTest3(): Unit = ()
  @Test def multiTest4(): Unit = ()
  @Test def multiTest5(): Unit = ()
}

class MultiAssumeFail1TestAssertions extends JUnitTest


text:
using System.Diagnostics;
using Microsoft.Xna.Framework;
using StardewValley.Objects;
using Object = StardewValley.Object;

namespace FarmAutomation.Common
{
    [DebuggerDisplay("{Location} : {Object.Name} => {Chest.Name}")]
    public class ConnectedTile
    {
        public Object Object { get; set; }
        public Chest Chest { get; set; }
        public Vector2 Location { get; set; }

        public bool Equals(ConnectedTile obj)
        {
            return Location.Equals(obj?.Location);
        }
    }
}


text:
#pragma once

#include <csignal>
#include <cstdlib>
#include <windows.h>

#ifdef DARWIN_FORCE_BUILTIN

#include "./win32_adapter.cpp"

#endif
namespace darwin {
	class win32_module_adapter : public module_adapter {
		HINSTANCE m_handle = nullptr;
		platform_adapter *m_adapter = nullptr;

		static void force_exit(int);

		static void handle_segfault(int);

	public:
		win32_module_adapter() {}

		virtual ~win32_module_adapter() {}

		virtual status get_state() const override
		{
			if (m_adapter != nullptr)
				return status::ready;
			else
				return status::leisure;
		}

		virtual results load_module(const std::string &path) override
		{
			signal(SIGSEGV, handle_segfault);
			signal(SIGINT, force_exit);
			signal(SIGABRT, force_exit);
#ifdef DARWIN_FORCE_BUILTIN
			m_adapter = module_resource();
#else
			m_handle = LoadLibrary(path.c_str());
			if (m_handle == nullptr) return results::failure;
			module_enterance enterance = (module_enterance) GetProcAddress(m_handle, module_enterance_name);
			m_adapter = enterance();
#endif
			if (m_adapter == nullptr) return results::failure;
			return results::success;
		}

		virtual results free_module() override
		{
			signal(SIGSEGV, nullptr);
			signal(SIGINT, nullptr);
			signal(SIGABRT, nullptr);
#ifndef DARWIN_FORCE_BUILTIN
			FreeLibrary(m_handle);
			m_handle = nullptr;
#endif
			m_adapter = nullptr;
			return results::success;
		}

		virtual platform_adapter *get_platform_adapter() override
		{
			return this->m_adapter;
		}
	} dwin32module;

	static darwin_rt runtime(&dwin32module);
}

void darwin::win32_module_adapter::force_exit(int flag)
{
	printf("Darwin have been exited safety.\n");
	runtime.exit();
	std::exit(0);
}

void darwin::win32_module_adapter::handle_segfault(int flag)
{
	printf("Your program have some problem about the Segmentation Fault.Please check your program after we terminate this program.\n");
	printf("Darwin have been exited safety.\n");
	runtime.exit();
	std::exit(-1);
}


text:
package strategy.impl;

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

import person.Person;
import strategy.StrategieI;

/**
 * @author DURIEZ Jean-Baptiste et QUINCY Jordane
 */
public abstract class Sondeur implements StrategieI {

	// Must be implemented in sub classes.
	@Override
	public abstract boolean goToTheBar(Person me,
			final List<Map<Person, Boolean>> turnHistoric);

	/**
	 *

	 * {@inheritDoc}
	 *

	 *
	 *

	 * A Sondeur stay at home, then go at bar multiple time and return true if the majority of the population is at bar.
	 *

	 */
	protected boolean haveToGoToTheBar(
			final List<Map<Person, Boolean>> turnHistoric) {
		// je reste chez me, ensuite je vais deux fois au bar. Si la majorité
		// reste chez eux, je reste également chez me (sinon je vais au bar).

		final int nbTurn = turnHistoric.size();
		if (nbTurn < 1) {
			// Stay at home at first round
			return false;
		} else if (nbTurn <= 3) {
			// Go to the bar
			return true;
		} else {

			int nbTotalPersonAtTheBar = 0;
			int nbTotalPerson = 0;
			final Map<Person, Boolean> turn = turnHistoric.get(turnHistoric
					.size() - 1);
			for (final Person i : turn.keySet()) {
				final boolean estPartiAuBar = turn.get(i);
				if (estPartiAuBar) {
					nbTotalPersonAtTheBar++;
				}
				nbTotalPerson++;
			}

			final double ratioNbPersonAtTheBarOnNbPersonAtThisTurn = (double) nbTotalPerson
					/ nbTotalPersonAtTheBar;

			return ratioNbPersonAtTheBarOnNbPersonAtThisTurn >= 0.5d;
		}
	}
}


text:
from murano.tests.unit.dsl.foundation import object_model as om
from murano.tests.unit.dsl.foundation import test_case

class TestCall(test_case.DslTestCase):
    def setUp(self):
        super(TestCall, self).setUp()
        self._runner = self.new_runner(om.Object('TestCall'))

    def test_call(self):
        self._runner.testCall()
        self.assertEqual(['called as call'], self._traces)

    def test_method(self):
        self._runner.testMethodInvocation()
        self.assertEqual(['called as method'], self._traces)

    def test_call_static(self):
        self._runner.testCallStatic()
        self.assertEqual(['called as static'], self._traces)

    def test_call_static_as_instance(self):
        self._runner.testCallStaticAsInstance()
        self.assertEqual(['called as static'], self._traces)


text:
<!doctype html>

    <meta charset="utf-8">

    <title>Representation Learning on Graphs with Jumping Knowledge Networks</title>

    <meta name="description" content="Class project presentation for COMP 766: Graph Representation Learning">
    <meta name="author" content="AlOrozco53">

    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">

    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">

    <link rel="stylesheet" href="../../css/reveal.css">
    <link rel="stylesheet" href="../../css/theme/custom_white.css" id="theme">

    <link rel="stylesheet" href="../../plugin/title-footer/title-footer.css">

    <link rel="stylesheet" href="../../lib/css/zenburn.css">

	      Representation Learning on Graphs with Jumping Knowledge Networks

	      Keyulu Xu1, Chengtao Li1, Yonglong Tian1, Tomohiro Sonobe2,
		Ken-ichi Kawarabayashi2, Stefanie Jegelka1

	      1. Massachusetts Institute of Technology (MIT)

		2. National Institute for Informatics, Tokyo;

		2018

	      presented by Albert M Orozco Camacho

Motivation

	      Neighborhood aggregation turns out to be a crucial part of representation
	      learning, due to the rise of graph neural networks.

	      Such procedure aims to extract high-level features from nodes via a
	      message passing scheme.

	      What do aggregation methods bring to the table?

	      A generalization of a graph isomorphism test, enabling to learn the topology and
	      distribution of node features in the neighborhood.

Caveats of Traditional Aggregation Schemes

	      Usually, traditional GCNs show state-of-the-art performance only with a 2-layer model,
	      while deeper models don't take advantage of accessing to more information.

	      Networks that exhibit a diversity in subgraph structures (such as node hubs)
	      yield inconsistent learning of node relations by GCNs.

	      Also, scale-free networks (ones that follow a power law distribution) may fail to be modeled.

	      - Graphs in Social Media

Neighborhood aggregation in GNNs

Changing Locality

	      Of special interest for this paper is to analyze how the spread of influence between nodes
	      is related to random walk distributions, and hence, what this tells us about GNN learning.

Influence distributions vs Random Walks

	      Is it possible to adaptively adjust (learn) the influence radii for each node and task?

Background

	    <textarea data-template>
	      ## Graph Neural Networks
	      Consider a undirected graph $G = (V, E)$:
	      - $X_v \in \mathbb{R}^{d_i}$ is a vector of features per each $v \in V$;
	      - $\tilde{G}$ is the graph obtained by adding self-loops to each vertex;
	      - let $h_v^{(l)} \in \mathbb{R}^{d_h}$ is the hidden feature of node $v$
	      by the $l$-th layer of the model.

	      Note:
	      The dimension of the hidden layers is assumed to be the same accross layers.
	    </textarea>

Hidden Layer Update for a GNN

	      $$
	      h_v^{(l)} = \sigma\left(W_l \cdot \text{AGGREGATE}\left(\{h_u^{(l-1)}, \forall u \in \tilde{N}(v)\}\right)\right)
	      $$

Graph Convolutional Neural Networks

	      $$
	      h_v^{(l)} = \text{RELU}\left(W_l \cdot \sum_{u \in \tilde{N}(v)}(\deg(v)\deg(u))^{-\frac{1}{2}} h_u^{(l-1)}\right)
	      $$

	      $$
	      h_v^{(l)} = \text{RELU}\left(W_l \cdot \frac{1}{\tilde{\deg}(v)} \sum_{u \in \tilde{N}(v)} h_u^{(l-1)}\right)
	      $$

	      The role of normalization in both equations determines how to rank nodes of higher degree.

Neighborhood Aggregation with Skip Connections

	      $$
	      h_{N(v)}^{(l)} = \sigma\left(W_l \cdot \text{AGGREGATE}_N\left(\{h_u^{(l-1)}, \forall u \in N(v)\}\right)\right)
	      $$

	      $$
	      h_v^{(l)} = \text{COMBINE}\left(h_v^{(l-1)}, h_{N(v)}^{(l)}\right)
	      $$

	      AGGREGATE and COMBINE are defined by the specific model.
	      This model can be combined with GAT and GraphSAGE, for instance, to add representational power.
	      Those approaches are orthogonal to what is presented here.

Influence Distributions

	      $$
	      I_x(y) = \frac{e^T \left[\frac{\partial h_x^{(k)}}{\partial h_y^{(0)}} e\right]}{\sum_{z \in V} e^T \frac{\partial h_x^{(k)}}{\partial h_z^{(0)}} e}
	      $$

	      where $e$ is an all-ones vector

		How does a change in the inpute of node $x$ affects the output of node $y$?

	    <textarea data-template>
	      ## Model Analysis
	    </textarea>

	    <textarea data-template>
	      ### Theorem 1

	      Given a $k$-layer GCN with averaging by each node's degree at each hidden layer update,  assume that all paths in the computation graph of the model are activated with the same probability of
	      success $\rho$.

	      Then the influence distribution $I_x$ for any node $x \in V$ is equivalent,
	      in expectation, to the $k$-step random walk distribution on $G$ starting at node $x$.

	      Note:
	      Note there is no assumption on the structure of graph $G$, thus guaranteeing
	      the practical intention of this result for the sake of this paper.
	    </textarea>

	    <textarea data-template>
	      ### A Crucial Implication of Theorem 1

	      Information aggregation rate while updating hidden layers depends on the
	      local structure radius.

	      - Large radii may lead to too much averaging.
	      - Small radii may lead to in- stabilities or insufficient information aggregation.
	    </textarea>

Jumping Knowledge Networks

The proposed aggregation scheme...

		makes each layer increase the size of the influence distribution by aggregating
		neighborhoods from the previous layer ⬆;

		combines, at the last layer, some of the previous layers' representations
		independently for each node;

		intermediate representations are said to jump to the last layer.

Aggregation Mechanisms

		CONCATENATION
		$$[h_v^{(1)},\ldots,h_v^{(k)}]$$

		MAX-POOLING. Select the most informative layer for each feature coordinate.

		LSTM-ATTENTION. Input $h_v^{(1)},\ldots,h_v^{(k)}$ into a bi-directional
		LSTM to generate forward and backward features $f_v^{(l)}$ and $b_v^{(l)}$ for each
		layer $l$; finally compute an attention score per each node by combining those
		for each layer.

	    <textarea data-template>
	      ## JK-Net learns to Adapt!
	    </textarea>

Proposition 1

		Assume that paths of the same length in the computation graph are activated with the same probability.

		The influence score $I(x, y)$ for any $x, y \in V$ under a $k$-layer JK-Net with layer-wise max-pooling is equivalent
		in expectation to a mixture of $0,\ldots,k$-step random walk distributions on $\tilde{G}$ at $y$
		starting at $x$, the coefficients of which depend on the values of the layer features $h_x^{(l)}$.

		There is no assumption on the structure of graph $G$!

Experiments

Datasets

	    <textarea data-template>
	      ## Settings

	      ![setup](../../img/jumping-dataset-stats.png)
	    </textarea>

	    <textarea data-template>
	      ## Results

	      Note:
	      Convergence is NOT guaranteed!
	    </textarea>

Conclusion

	      Goal: Provide a representation learning scheme that can generalize
	      better on diverse variety of network structure, than the one proposed for GCN's

	      Problem: Denser subgraphs may cause aggregation algorithms to converge
	      in expectation to biased random walks. ☹

	      Solution: JK-Nets aggregate and leverage information from more than
	      one hidden layers.😁

	      JK-Nets with the LSTM-attention aggregators outperform the non-adaptive
	      models GraphSAGE, GAT and JK-Nets with concatenation aggregators.

		  https://github.com/ShinKyuY/Representation_Learning_on_Graphs_with_Jumping_Knowledge_Networks

Future Work

	      Exploring other layer aggregators and studying the effect of the combination of various
	      layer-wise and node-wise aggregators on different types of graph structures.

	      How can sequence modelling by itself impact the task of layer aggregation?

	      Are there smarter ways to keep track of node/community correlations within a network?

Thank you!


text:
"""
Usage:

   calc-blast-cover.py reference.fa query.x.reference.blastn minmatch query.fa

calc-blast-cover calculates the fraction of bases in 'reference.fa' that are
covered by BLAST matches from 'query.fa', for sequence in 'query.fa' that are
longer than 'minmatch'.
"""

import sys
import blastparser

import screed

if len(sys.argv) != 5:
   print>>sys.stderr, "Usage: calc-blast-cover.py b.seqs a.x.b matchlen a.seqs"
   sys.exit(-1)

MIN_SCORE=200
MIN_QUERY_LEN = int(sys.argv[3])

# load in the query sequences into a list
query_seqs = set([ record.name for record in screed.open(sys.argv[4]) \
                       if len(record.sequence) >= MIN_QUERY_LEN ])

# create empty lists representing the total number of bases in the reference
covs = {}
for n, record in enumerate(screed.open(sys.argv[1])):
    if n % 1000 == 0:
        sys.stdout.write('+')
        sys.stdout.flush()

    covs[record.name] = [0] * len(record.sequence)

# run through the BLAST records in the query, and calculate how much of
# the reference is covered by the query.
for n, record in enumerate(blastparser.parse_fp(open(sys.argv[2]))):
    if n % 100 == 0:
        sys.stdout.write('.')
        sys.stdout.flush()

    if record.query_name not in query_seqs:
        continue

    for hit in record.hits:
        for match in hit.matches:
            if match.score < MIN_SCORE:
                continue

            cov = covs.get(hit.subject_name)
            if not cov:
                continue

            start = min(match.subject_start, match.subject_end) - 1
            end = max(match.subject_start, match.subject_end)
            for i in range(start, end):
                cov[i] = 1

print ''

# print out summary statistics for each of the reference.
coved = 0
total = 0
for name in covs:
    coved += sum(covs[name])
    total += len(covs[name])
    f = sum(covs[name]) / float(len(covs[name]))
    #print name, sum(covs[name]), len(covs[name]), f

print 'total bases in reference:', total
print 'total ref bases covered :', coved
print 'fraction                :', coved / float(total)
print 'reference               :', sys.argv[1]
print 'blast file              :', sys.argv[2]
print 'query sequences         :', sys.argv[4]

#print coved, total, coved / float(total), sys.argv[1], sys.argv[2], MIN_QUERY_LEN


text:
package com.github.agaro1121.models.leagues

import scala.util.Try

sealed trait LadderDifficulty

object LadderDifficulty {

  case object STANDARD extends LadderDifficulty {
    override def toString: String = "1"
  }

  case object CRUEL extends LadderDifficulty {
    override def toString: String = "2"
  }

  case object MERCILESS extends LadderDifficulty {
    override def toString: String = "3"
  }

  def fromString(string: String): Option[LadderDifficulty] = {
    Try(string.toInt).toOption.flatMap(fromInt)
  }

  def fromInt(int: Int): Option[LadderDifficulty] = {
    int match {
      case 1 => Some(STANDARD)
      case 2 => Some(CRUEL)
      case 3 => Some(MERCILESS)
      case _ => None
    }
  }

}


text:
'use strict';

/**
 * Module dependencies.
 */

import uniqueValidator from 'mongoose-unique-validator';
import mongoose from 'mongoose';
import mongoosastic from 'mongoosastic';
const Schema = mongoose.Schema;

/**
 * Media Schema
 */
 const MediaSchema = new Schema({
   title: { type : String,trim : true, unique: true,es_indexed:true,es_boost:4.0},
   year: { type : String, default : '', trim : true },
   released: { type : String, default : '', trim : true },
   runtime: { type : String, default : '', trim : true },
   genre: { type : Number},
   tags:{type: [String], default:[], trim:true},
   director: { type : [String],default:[],es_indexed:true },
   writer: { type : [String], default :[]},
   actors: { type : [String],es_indexed:true,es_boost:2.0 },
   plot: { type : String, default : '', trim : true },
   language: { type : String, default : '', trim : true },
   description: { type : String, default : '', trim : true },
   poster: { type : String, default : '', trim : true, unique: true  },
   image: { type : String, default : '', trim : true },
   imdbRating: { type : Number, default : 0},
   type:Number,
   downloads:Number,
   link:String,
   createdAt:{ type : Date, default : Date.now },
   location:String,
   size:Number,
   blksize:Number,
   birthtime:String
 });

MediaSchema.plugin(mongoosastic);
MediaSchema.plugin(uniqueValidator);
/**
 * Validations
 */

MediaSchema.path('genre').required(true, 'Media genre cannot be blank');
MediaSchema.path('actors').required(true, 'Media Actors cannot be blank');
MediaSchema.path('title').required(true, 'Media Title cannot be blank');
MediaSchema.path('type').required(true, 'Media type cannot be blank');
MediaSchema.path('location').required(true, 'Media Location on disk cannot be null');

MediaSchema.pre('save', function(next) {
  const err = this.validateSync();
  if (err && err.toString()) throw new Error(err.toString());
  next(err);
});

//model names
const env = process.env.NODE_ENV || 'development';
const index = env == 'development' || 'test' ? 'Media-test' : 'Media';
console.log('index: '+ index);
const Media = mongoose.model(index, MediaSchema);
//create index if none exists
Media.createMapping(function(err, mapping) {
  if (err) {
    console.log('error creating mapping (you can safely ignore this)');
    console.log(err);
  } else {
    console.log('mapping created!');
    console.log(mapping);
  }
});

export default Media;


text:
#pragma once
#include "../JuceLibraryCode/JuceHeader.h"
#include "SynthParameters.h"

class Synth;

class SynthSound : public SynthesiserSound
{
private:
    Synth& synth;    // reference to owner Synth (does not change)

public:
    SynthSound(Synth& ownerSynth);

    // our sound applies to all notes, all channels
    bool appliesToNote(int /*midiNoteNumber*/) override { return true; }
    bool appliesToChannel(int /*midiChannel*/) override { return true; }

    // pointer to current parameters (may change, e.g. when new program selected)
    SynthParameters* pParams;

    // call to notify owner Synth, that one or more parameters have been changed
    void parameterChanged();
};


text:
package org.jfree.xml.parser.coretypes;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Stack;
import java.util.Vector;

import org.jfree.xml.parser.AbstractXmlReadHandler;
import org.jfree.xml.parser.XmlReadHandler;
import org.jfree.xml.parser.XmlReaderException;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;

/**
 * A SAX handler for reading a list from an XML element.
 */
public class ListReadHandler extends AbstractXmlReadHandler {

    /** The list under construction. */
    private List retval;

    /** The handlers. */
    private ArrayList handlers;

    /** The type of list ('array-list', 'linked-list', 'stack', 'vector'). */
    private String listType;

    /**
     * Default constructor.
     */
    public ListReadHandler() {
        super();
    }

    /**
     * Start parsing.
     *
     * @param attrs  the attributes.
     *
     * @throws SAXException if there is a parsing error.
     */
    protected void startParsing(final Attributes attrs) throws SAXException {
        this.listType = attrs.getValue("type");
        if (this.listType == null) {
            this.listType = "array-list";
        }
        this.handlers = new ArrayList();
    }

    /**
     * Gets a handler for a child.
     *
     * @param tagName  the tag name.
     * @param atts  the attributes.
     *
     * @return A handler.
     *
     * @throws XmlReaderException if there is a problem with the reader.
     * @throws SAXException if there is a parsing error.
     */
    protected XmlReadHandler getHandlerForChild(final String tagName, final Attributes atts)
        throws XmlReaderException, SAXException {
        final XmlReadHandler handler = getRootHandler().createHandler(Object.class, tagName, atts);
        this.handlers.add(handler);
        return handler;
    }

    /**
     * Parsing is finished.
     *
     * @throws SAXException if there is a parsing error.
     * @throws XmlReaderException if there is a problem with the reader.
     *
     */
    protected void doneParsing() throws SAXException, XmlReaderException {
        final XmlReadHandler[] handler = (XmlReadHandler[])
        this.handlers.toArray(new XmlReadHandler[this.handlers.size()]);
        this.retval = createList(handler.length);
        for (int i = 0; i < handler.length; i++) {
            this.retval.add(handler[i].getObject());
        }
        this.handlers.clear();
    }

    /**
     * Creates a list.
     *
     * @param initialSize  the initial size.
     *
     * @return A new list.
     */
    private List createList(final int initialSize) {
        if (this.listType.equals("stack")) {
            return new Stack();
        }
        if (this.listType.equals("linked-list")) {
            return new LinkedList();
        }
        if (this.listType.equals("vector")) {
            return new Vector(initialSize);
        }
        return new ArrayList(initialSize);
    }

    /**
     * Returns the object under construction.
     *
     * @return The list.
     */
    public Object getObject() {
        return this.retval;
    }

}


text:
layout: post
title:  "OSCP Training"
date:   2016-08-22 15:07:19
categories: [training, oscp]
comments: false
---
Woot, so I got approved to take OSCP, so planning on starting that the end of September.  That gives me a month to get my feet wet on Exploit Development, since that is a very weak area of mine.

I'm expecting that with my previous trainings, and experiences that I won't have issues on many parts of it, but I know I'll have to Try Harder many, many, many times so electing to go with the 90 days of labs option so I can fully exploit everything there is in the Lab Environment before going to the exam.


text:
<?php

namespace Helloworld\Controller;

use Zend\Mvc\Controller\AbstractActionController;
use Zend\View\Model\ViewModel;

class IndexController extends AbstractActionController
{
    public function indexAction()
    {
        $greetingSrv = $this->getServiceLocator()->get('greetingService');
        return new ViewModel(array('greeting' => $greetingSrv->getGreeting()));
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (c) 2015 Tapglue (https://www.tapglue.com/). All rights reserved.
  ~
  ~ 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.
  -->

<manifest package="com.tapglue.exampleapp"
          xmlns:android="http://schemas.android.com/apk/res/android">

    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

    <application
        android:name=".ExampleApplication"
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".LoginActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>

                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
        <activity android:name=".PeopleActivity"/>
        <activity
            android:name=".UserDetailsActivity"
            android:label="@string/title_activity_user_details"
            android:theme="@style/AppTheme"/>
        <activity
            android:name=".FeedActivity"
            android:label="@string/title_activity_feed"
            android:theme="@style/AppTheme">
        </activity>
        <activity android:name=".EventsActivity">
        </activity>
    </application>

</manifest>


text:
#include <shogun/multiclass/KDTreeKNNSolver.h>
#include <shogun/multiclass/tree/KDTree.h>
#include <shogun/lib/Signal.h>

using namespace shogun;

KDTREEKNNSolver::KDTREEKNNSolver(const int32_t k, const float64_t q, const int32_t num_classes, const int32_t min_label, const SGVector<int32_t> train_labels,  const int32_t leaf_size):
KNNSolver(k, q, num_classes, min_label, train_labels)
{
	init();

	m_leaf_size=leaf_size;
}

std::shared_ptr<MulticlassLabels> KDTREEKNNSolver::classify_objects(std::shared_ptr<Distance> knn_distance, const int32_t num_lab, SGVector<int32_t>& train_lab, SGVector<float64_t>& classes) const
{
	auto output=std::make_shared<MulticlassLabels>(num_lab);
	auto lhs = knn_distance->get_lhs();
	auto kd_tree = std::make_shared<KDTree>(m_leaf_size);
	kd_tree->build_tree(lhs->as<DenseFeatures<float64_t>>());

	auto query = knn_distance->get_rhs();
	kd_tree->query_knn(query->as<DenseFeatures<float64_t>>(), m_k);
	SGMatrix<index_t> NN = kd_tree->get_knn_indices();
	for (int32_t i = 0; i < num_lab && (!cancel_computation()); i++)
	{
		//write the labels of the k nearest neighbors from theirs indices
		for (int32_t j=0; j<m_k; j++)
			train_lab[j] = m_train_labels[ NN(j,i) ];

		//get the index of the 'nearest' class
		int32_t out_idx = choose_class(classes.vector, train_lab.vector);
		//write the label of 'nearest' in the output
		output->set_label(i, out_idx + m_min_label);
	}
	return output;
}

SGVector<int32_t> KDTREEKNNSolver::classify_objects_k(std::shared_ptr<Distance> knn_distance, const int32_t num_lab, SGVector<int32_t>& train_lab, SGVector<int32_t>& classes) const
{
	SGVector<int32_t> output(m_k*num_lab);

	//allocation for distances to nearest neighbors
	SGVector<float64_t> dists(m_k);

	auto lhs = knn_distance->get_lhs();
	auto kd_tree = std::make_shared<KDTree>(m_leaf_size);
	kd_tree->build_tree(lhs->as<DenseFeatures<float64_t>>());

	auto data = knn_distance->get_rhs();
	kd_tree->query_knn(data->as<DenseFeatures<float64_t>>(), m_k);
	SGMatrix<index_t> NN = kd_tree->get_knn_indices();
	for (index_t i = 0; i < num_lab && (!cancel_computation()); i++)
	{
		//write the labels of the k nearest neighbors from theirs indices
		for (index_t j=0; j<m_k; j++)
		{
			train_lab[j] = m_train_labels[ NN(j,i) ];
			dists[j] = knn_distance->distance(NN(j,i), i);
		}
		Math::qsort_index(dists.vector, train_lab.vector, m_k);

		choose_class_for_multiple_k(output.vector+i, classes.vector, train_lab.vector, num_lab);
	}

	return output;
}


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

import com.siyeh.IntentionPowerPackBundle;
import com.siyeh.ipp.IPPTestCase;

/**
 * @see ReplaceForEachLoopWithIndexedForLoopIntention
 * @see ReplaceForEachLoopWithOptimizedIndexedForLoopIntention
 */
public class ReplaceForEachLoopWithIndexedForLoopIntentionTest extends IPPTestCase {
  public void testLabeledForLoop() { doTest(); }
  public void testNormalForeachLoop() { doTest(); }
  public void testThisExpr() { doTest(); }
  public void testNewArray() { doTest(); }
  public void testNoNPE() { doTest(); }
  public void testFQList() { doTest(); }
  public void testBlockNeeded() { doTest(); }
  public void testBlockNeededLabeled() { doTest(); }
  public void testVar() { doTest(); }

  @Override
  protected String getIntentionName() {
    return IntentionPowerPackBundle.message("replace.for.each.loop.with.optimized.indexed.for.loop.intention.name");
  }

  @Override
  protected String getRelativePath() {
    return "forloop/indexed";
  }
}


text:
import React from 'react'
import { useMemo } from 'react'

export const DOTS = '...'

interface RangeItems {
  start: number
  end: number
}

const range = (rangeItems: RangeItems) => {
  const { end, start } = rangeItems
  let length: number = end - start + 1
  return Array.from({ length }, (_, idx) => idx + start)
}

interface PaginationItems {
  totalPageCount: number
  pageSize: number
  siblingCount: number
  currentPage: number
}

export const usePagination = (paginationItems: PaginationItems) => {
  const { totalPageCount, pageSize, siblingCount, currentPage } = paginationItems
  const paginationRange = useMemo(() => {
    const totalPageNumbers = siblingCount + 5

    if (totalPageNumbers >= totalPageCount) {
      return range({ start: 1, end: totalPageCount })
    }

    const leftSiblingIndex = Math.max(currentPage - siblingCount, 1)
    const rightSiblingIndex = Math.min(currentPage + siblingCount, totalPageCount)

    const shouldShowLeftDots = leftSiblingIndex >= 2
    const shouldShowRightDots = rightSiblingIndex < totalPageCount - 2

    const firstPageIndex = 1
    const lastPageIndex = totalPageCount

    if (!shouldShowLeftDots && shouldShowRightDots) {
      let leftItemCount = 1 + 2 * siblingCount
      let leftRange = range({ start: 1, end: leftItemCount })

      return [...leftRange, DOTS, totalPageCount]
    }

    if (shouldShowLeftDots && !shouldShowRightDots) {
      let rightItemCount = 3 + 2 * siblingCount
      let rightRange = range({ start: totalPageCount - rightItemCount + 1, end: totalPageCount })
      return [firstPageIndex, DOTS, ...rightRange]
    }

    if (shouldShowLeftDots && shouldShowRightDots) {
      let middleRange = range({ start: leftSiblingIndex, end: rightSiblingIndex })
      return [firstPageIndex, DOTS, ...middleRange, DOTS, lastPageIndex]
    }

    let middleRange = range({ start: leftSiblingIndex, end: rightSiblingIndex })
    return [firstPageIndex, ...middleRange, lastPageIndex]
  }, [totalPageCount, pageSize, siblingCount, currentPage])

  return paginationRange
}


text:
find_path(LIBEV_INCLUDE_DIR NAMES ev.h)
find_library(LIBEV_LIBRARIES NAMES ev)

if(LIBEV_INCLUDE_DIR AND LIBEV_LIBRARIES)
    set(LIBEV_FOUND ON)
endif(LIBEV_INCLUDE_DIR AND LIBEV_LIBRARIES)

if(LIBEV_FOUND)
    if (NOT LIBEV_FIND_QUIETLY)
        message(STATUS "Found libev includes: ${LIBEV_INCLUDE_DIR}/ev.h")
        message(STATUS "Found libev library: ${LIBEV_LIBRARIES}")
    endif (NOT LIBEV_FIND_QUIETLY)
else(LIBEV_FOUND)
    if (LIBEV_FIND_REQUIRED)
        message(FATAL_ERROR "Could not find libev development files")
    endif (LIBEV_FIND_REQUIRED)
endif (LIBEV_FOUND)


text:
<!DOCTYPE html>

<meta charset='utf-8'>
<link href='../../../exports.css' rel='stylesheet'>
<link href='../../../exports.css' rel='stylesheet'>

xdamman's posterous

This is an archived post
This is an archived post

Previous

Index

Next

Saturday, visit of an orphanage

February 10 2007,  7:12 PM
 by Xavier Damman

Last but not least, the weekend! The chance to break the rhythm of the week. So I woke up at 8 (instead of 6 and something!), I launched  and went to the university at 10. The thing is that I told my student of my second class that they could come Saturday to practice a bit. So I had to open them the computer room. I left the key to a trusted student and then, I went with Julien, Bénédicte (the two french volunteers) and Elias (the worker of the local Cybercafe) to a small village at 12km from here.

We met there a french couple of volunteers; Sarah and Denis. They are here with the same association than Bénédicte and Julien (DCC). They received us in their big colonial-like house. We ate in their garden. It was very great.

After that, we visited the orphanage where they are working for two years. It is a really big one. They have something like 60 orphans from one week of age till 20.
Denis shared with me a very interesting thought. Since Africa is a matripatriarchal society (which means that families are many levels deep), there were quite no orphans. If your parents die, then you would be in charge of your aunt or whatever.
But since we have implemented orphanages, we have created the need. And now, there are many more orphans than before.
And most of the time, they are not really orphans since they still have their father (usually their mother died while giving birth). But since it's only the mothers that care the children, the fathers just give the child to the orphanage.

That orphanage was created by an italian couple who lost their two children. They give all their money and all their time one month a year for it. They made an incredible work. Eventually, they achieve to build a well-equiped orphanage. But isn't it too much? Most of the equipment isn't used correctly (they have many efficient water heaters but they just don't use them). On another hand, the people in the village use to say that these orphans have a better life than themselves which created conflicts.

What I wanna show here is that although we can have good intentions, we do cooperation, that we really help to change the situation. Maybe it just helps us to have good consciousness. That's it.
And we can extend that thought on all the cooperation projects. What they eventually all do is firstly reinforcing the dependence between Africa and Europa.

The entrance of the orphanage and a container used to carry materials for the italian cooperation.
They keep it there since it's most expensive to bring it back than to buy a new container (!).

The problem is that when we see a poor little child in need of help, we can't help trying to help him although on the long term, our help will just generate more and more people begging for help. Should this mean that we don't have to help the people in need? For sure not. When there is urgency, we have to provide all the help we can. But in all others cases, we shouldn't propose anything that should be normally provided by the local government. And what if their government is corrupted, doesn't do its job? Then it's just their problem, not ours. Otherwise they will always be as they are.
It's a very difficult question though.

13 views and 0 responses


text:
package org.mindinformatics.gwt.domeo.plugins.persistence.annotopia.model;

/**
 * @author Paolo Ciccarese <paolo.ciccarese@gmail.com>
 */
public class MAnnotopiaPerson implements IAnnotopiaAgent {

	private String id;
	private String type;
	private String name;

	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public String getType() {
		return type;
	}
	public void setType(String type) {
		this.type = type;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
}


text:
<!doctype html>

    <base href="/">
    <title>Welcome to Cross App Links</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <link href="https://fonts.googleapis.com/css?family=Lato:300,400,500,600,700,800,900" rel="stylesheet">

    <link rel="stylesheet" href="../static/bower_components/dstyle_resetCSS/reset.min.css">
    <link rel="stylesheet" href="../static/bower_components/bootstrap/dist/css/bootstrap.min.css">

    <link rel="stylesheet" href="../static/css/main.css">
    <link rel="stylesheet" href="../static/css/loginpage.css">
    <link rel="stylesheet" href="../static/css/media.css">

Github

Privacy & License

About project

Cross App Links

Keep all your places in one.

{{ type }}

                {{message}}

             Go back to main page.


text:
package com.whitepages.proapi.api.client;

import com.whitepages.proapi.api.query.Query;
import com.whitepages.proapi.api.response.Response;
import com.whitepages.proapi.data.entity.Entity;

/**
 * A standardized, generic implementation of {@link ResultFinder} that properly
 * threads together the {@link QueryCoder}, {@link DataSource}, and
 * {@link ResponseDecoder} to execute a find request.
 *
 * @see com.whitepages.proapi.api.client.ResultFinder
 */
public class ResultFinderImpl<Q extends Query, R extends Response<? extends Entity>, U, V> implements ResultFinder<Q, R> {

    private final QueryCoder<Q, U> queryCoder;
    private final DataSource<U, V> dataSource;
    private final ResponseDecoder<R, V> responseDecoder;

    public ResultFinderImpl(QueryCoder<Q, U> queryCoder, DataSource<U, V> dataSource, ResponseDecoder<R, V> responseDecoder) {
        this.queryCoder = queryCoder;
        this.dataSource = dataSource;
        this.responseDecoder = responseDecoder;
    }

    @Override
    public R find(Q query, Client client) throws FindException {
        U queryData = queryCoder.encode(query, client);
        V responseData = dataSource.execute(queryData, client);
        return responseDecoder.decode(responseData, client);
    }

    @Override
    public R find(Q query, Client client, int connectTimeout, int readTimeout) throws FindException {
        U queryData = queryCoder.encode(query, client);
        V responseData = dataSource.execute(queryData, client, connectTimeout, readTimeout);
        return responseDecoder.decode(responseData, client);
    }
}


text:
package sync

import (
	"context"
	"testing"

	"github.com/rclone/rclone/fs/cache"
	"github.com/rclone/rclone/fs/rc"
	"github.com/rclone/rclone/fstest"
	"github.com/stretchr/testify/assert"
	"github.com/stretchr/testify/require"
)

func rcNewRun(t *testing.T, method string) (*fstest.Run, *rc.Call) {
	if *fstest.RemoteName != "" {
		t.Skip("Skipping test on non local remote")
	}
	r := fstest.NewRun(t)
	call := rc.Calls.Get(method)
	assert.NotNil(t, call)
	cache.Put(r.LocalName, r.Flocal)
	cache.Put(r.FremoteName, r.Fremote)
	return r, call
}

// sync/copy: copy a directory from source remote to destination remote
func TestRcCopy(t *testing.T) {
	r, call := rcNewRun(t, "sync/copy")
	defer r.Finalise()
	r.Mkdir(context.Background(), r.Fremote)

	file1 := r.WriteBoth(context.Background(), "file1", "file1 contents", t1)
	file2 := r.WriteFile("subdir/file2", "file2 contents", t2)
	file3 := r.WriteObject(context.Background(), "subdir/subsubdir/file3", "file3 contents", t3)

	fstest.CheckItems(t, r.Flocal, file1, file2)
	fstest.CheckItems(t, r.Fremote, file1, file3)

	in := rc.Params{
		"srcFs": r.LocalName,
		"dstFs": r.FremoteName,
	}
	out, err := call.Fn(context.Background(), in)
	require.NoError(t, err)
	assert.Equal(t, rc.Params(nil), out)

	fstest.CheckItems(t, r.Flocal, file1, file2)
	fstest.CheckItems(t, r.Fremote, file1, file2, file3)
}

// sync/move: move a directory from source remote to destination remote
func TestRcMove(t *testing.T) {
	r, call := rcNewRun(t, "sync/move")
	defer r.Finalise()
	r.Mkdir(context.Background(), r.Fremote)

	file1 := r.WriteBoth(context.Background(), "file1", "file1 contents", t1)
	file2 := r.WriteFile("subdir/file2", "file2 contents", t2)
	file3 := r.WriteObject(context.Background(), "subdir/subsubdir/file3", "file3 contents", t3)

	fstest.CheckItems(t, r.Flocal, file1, file2)
	fstest.CheckItems(t, r.Fremote, file1, file3)

	in := rc.Params{
		"srcFs": r.LocalName,
		"dstFs": r.FremoteName,
	}
	out, err := call.Fn(context.Background(), in)
	require.NoError(t, err)
	assert.Equal(t, rc.Params(nil), out)

	fstest.CheckItems(t, r.Flocal)
	fstest.CheckItems(t, r.Fremote, file1, file2, file3)
}

// sync/sync: sync a directory from source remote to destination remote
func TestRcSync(t *testing.T) {
	r, call := rcNewRun(t, "sync/sync")
	defer r.Finalise()
	r.Mkdir(context.Background(), r.Fremote)

	file1 := r.WriteBoth(context.Background(), "file1", "file1 contents", t1)
	file2 := r.WriteFile("subdir/file2", "file2 contents", t2)
	file3 := r.WriteObject(context.Background(), "subdir/subsubdir/file3", "file3 contents", t3)

	fstest.CheckItems(t, r.Flocal, file1, file2)
	fstest.CheckItems(t, r.Fremote, file1, file3)

	in := rc.Params{
		"srcFs": r.LocalName,
		"dstFs": r.FremoteName,
	}
	out, err := call.Fn(context.Background(), in)
	require.NoError(t, err)
	assert.Equal(t, rc.Params(nil), out)

	fstest.CheckItems(t, r.Flocal, file1, file2)
	fstest.CheckItems(t, r.Fremote, file1, file2)
}


text:
package base

import "golang.org/x/net/context"

// Keyer is an interface for keyed data.
type Keyer interface {
	Key() []byte
}

// Producer function emits output with key and Value.
type Producer func(ctx context.Context, outputs chan<- Keyer)

// Consumer function receives inputs.
type Consumer func(inputs <-chan Keyer)

// Mapper function takes a single input with key and value, and emits
// outputs with key and value.
type Mapper func(input Keyer, outputs chan<- Keyer)

// MapWorker function takes inputs and emits outputs. If done is
// closed, the worker stops.
type MapWorker func(ctx context.Context, inputs <-chan Keyer, outputs chan<- Keyer)

// IdentityMapper just propagates input to output as is without
// copying the content of key and value. It does not even copy the
// data struct content.
func IdentityMapper(input Keyer, outputs chan<- Keyer) {
	defer close(outputs)
	outputs <- input
}

// NopConsumer consumes all inputs without doing anything.
func NopConsumer(inputs <-chan Keyer) {
	for _ = range inputs {
	}
}

// SequentialMapWorker runs mapper function for each input in inputs
// and emits to outputs sequentially until inputs channel is closed.
func SequentialMapWorker(mapper Mapper) MapWorker {
	return func(ctx context.Context, inputs <-chan Keyer, outputs chan<- Keyer) {
		defer close(outputs)
		for input := range inputs {
			c := make(chan Keyer)
			go mapper(input, c)
			for output := range c {
				select {
				case outputs <- output:
				case <-ctx.Done():
					return
				}
			}
		}
	}
}

// ChainMapWorkers chains multiple map workers sequentially.
func ChainMapWorkers(mapWorkers []MapWorker) MapWorker {
	return func(ctx context.Context, inputs <-chan Keyer, outputs chan<- Keyer) {
		if len(mapWorkers) == 0 {
			go SequentialMapWorker(IdentityMapper)(ctx, inputs, outputs)
			return
		}
		if len(mapWorkers) == 1 {
			go mapWorkers[0](ctx, inputs, outputs)
			return
		}
		channels := make([]chan Keyer, len(mapWorkers)-1)
		channels[0] = make(chan Keyer)
		go mapWorkers[0](ctx, inputs, channels[0])
		for i := 1; i < len(mapWorkers)-1; i++ {
			channels[i] = make(chan Keyer)
			go mapWorkers[i](ctx, channels[i-1], channels[i])
		}
		go mapWorkers[len(mapWorkers)-1](
			ctx,
			channels[len(mapWorkers)-2],
			outputs,
		)
	}
}

// Produce is a helper function to run the producer. It returns the
// output channel.
func Produce(ctx context.Context, producer Producer) <-chan Keyer {
	c := make(chan Keyer)
	go producer(ctx, c)
	return c
}

// Work is a helper function to run the map worker. It returns the
// output channel.
func Work(ctx context.Context, mapWorker MapWorker, inputs <-chan Keyer) <-chan Keyer {
	c := make(chan Keyer)
	go mapWorker(ctx, inputs, c)
	return c
}


text:
/*
 * Copyright (C) 1990 by the Massachusetts Institute of Technology
 *
 * Export of this software from the United States of America is assumed
 * to require a specific license from the United States Government.
 * It is the responsibility of any person or organization contemplating
 * export to obtain such a license before exporting.
 *
 * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
 * distribute this software and its documentation for any purpose and
 * without fee is hereby granted, provided that the above copyright
 * notice appear in all copies and that both that copyright notice and
 * this permission notice appear in supporting documentation, and that
 * the name of M.I.T. not be used in advertising or publicity pertaining
 * to distribution of the software without specific, written prior
 * permission.  M.I.T. makes no representations about the suitability of
 * this software for any purpose.  It is provided "as is" without express
 * or implied warranty.
 *
 * $FreeBSD: soc2013/dpl/head/contrib/telnet/libtelnet/key-proto.h 87180 2001-11-30 21:06:38Z markm $
 */

#ifndef	__KEY_PROTO__
#define	__KEY_PROTO__

int key_file_exists(void);
void key_lookup(unsigned char *, Block);
void key_stream_init(Block, Block, int);
unsigned char key_stream(int, int);
#endif


text:
package com.shaubert.contacts;

import java.util.Comparator;

public class ContactTimesComparator implements Comparator<Contact> {
    @Override
    public int compare(Contact lhs, Contact rhs) {
        return compare(rhs.getTimesContacted(), lhs.getTimesContacted());
    }

    int compare(int lhs, int rhs) {
        return lhs < rhs ? -1 : (lhs == rhs ? 0 : 1);
    }
}


text:
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Security.Cryptography;
using System.Text;

namespace OsEngine.Market.Servers.OKX.Entity
{
    static class Encryptor
    {
        public static string HmacSHA256(string infoStr, string secret)
        {
            byte[] sha256Data = Encoding.UTF8.GetBytes(infoStr);
            byte[] secretData = Encoding.UTF8.GetBytes(secret);
            using (var hmacsha256 = new HMACSHA256(secretData))
            {
                byte[] buffer = hmacsha256.ComputeHash(sha256Data);
                return Convert.ToBase64String(buffer);
            }
        }

        public static string MakeAuthRequest(string apiKey, string secret, string phrase)
        {
            var timeStamp = Convert.ToInt64((DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds);
            var sign = Encryptor.HmacSHA256($"{timeStamp}GET/users/self/verify", secret);

            List<AuthObject> listObject = new List<AuthObject>();

            listObject.Add(new AuthObject()
            {
                apiKey = apiKey,
                passphrase = phrase,
                timestamp = timeStamp.ToString(),
                sign = sign
            });

            var info = new
            {
                op = "login",
                args = listObject
            };

            var json = JsonConvert.SerializeObject(info);

            return json;
        }

        public class AuthObject
        {
            public string apiKey;
            public string passphrase;
            public string timestamp;
            public string sign;
        }

    }
}


text:
'use strict';

const TVDB = require('..');
const API_KEY = process.env.TVDB_KEY;

const chai = require('chai');
const chaiAsPromised = require('chai-as-promised');
const expect = chai.expect;

chai.use(chaiAsPromised);

describe('#getSeriesByName', () => {

    it('should return an array of available matches', () => {
        const tvdb = new TVDB(API_KEY);

        return tvdb.getSeriesByName('The Walking Dead').then(response => {
            expect(response).to.have.length.of.at.least(2);

            let theWalkingDeadShow = response.find(show => show.id === 153021);
            expect(theWalkingDeadShow).to.exist;
            expect(theWalkingDeadShow.id).to.equal(153021);
            expect(theWalkingDeadShow.seriesName).to.equal('The Walking Dead');

            let fearTheWalkingDeadShow = response.find(show => show.id === 290853);
            expect(fearTheWalkingDeadShow).to.exist;
            expect(fearTheWalkingDeadShow.id).to.equal(290853);
            expect(fearTheWalkingDeadShow.seriesName).to.equal('Fear the Walking Dead');
        });
    });

    it('should return result for unescaped series name', () => {
        const tvdb = new TVDB(API_KEY);

        return tvdb.getSeriesByName('Eastbound & Down').then(response => {
            expect(response).to.have.length.of.at.least(1);

            let show = response.find(s => s.id === 82467);
            expect(show).to.exist;
        });
    });

    describe('returns the correct data for other languages', () => {

        it('if given in constructor', () => {
            const tvdb = new TVDB(API_KEY, 'de');

            return tvdb.getSeriesByName('Simpsons').then(response => {
                expect(response).to.have.length.of.at.least(1);

                let show = response.find(s => s.id === 71663);
                expect(show).to.exist;
                expect(show.id).to.equal(71663);
                expect(show.seriesName).to.equal('Die Simpsons');
            });
        });

        it('if given in function call', () => {
            const tvdb = new TVDB(API_KEY);

            return tvdb.getSeriesByName('Simpsons', { lang: 'de' }).then(response => {
                expect(response).to.have.length.of.at.least(1);

                const show = response.find(s => s.id === 71663);
                expect(show).to.exist;
                expect(show.id).to.equal(71663);
                expect(show.seriesName).to.equal('Die Simpsons');
            });
        });

    });

    describe('returns 404 error when no matches are found', () => {

        it(`when search term is 'asdasqwerty'`, () => {
            const tvdb = new TVDB(API_KEY);

            return expect(tvdb.getSeriesByName('asdasqwerty')).to.be.rejected;
        });

        it(`when search term is blank`, () => {
            const tvdb = new TVDB(API_KEY);

            return expect(tvdb.getSeriesByName('')).to.be.rejected;
        });

    });

});


text:
package hydrograph.engine.spark.components.utils

import org.slf4j.{Logger, LoggerFactory}
/**
  * The Class TeradataTableDescriptor.
  *
  * @author Bitwise
  *
  */

class TeradataTableDescriptor(tableName: String,
                              columnNames: List[String],
                              columnDefs: List[String],
                              primaryKeys: List[String],
                              databaseType: String) extends Serializable {
  val LOG: Logger = LoggerFactory.getLogger(classOf[TeradataTableDescriptor])

  var createTableStatement: List[String] = Nil
  var teradataCreateTableStatement = Nil
  var field: String = ""
  var primaryIndex: String = ""

  def getCreateTableStatement(): String = {
    createTableStatement = addCreateTableBody()
    val createTableStatment = String.format("CREATE TABLE %s ( %s )",
      tableName,
      joinField(createTableStatement.reverse, ",")) + addPrimaryKey()

    LOG.info("Create query '" + createTableStatment + "' for " + databaseType + " output component")
    createTableStatment
  }

  def addCreateTableBody(): List[String] = {
    createTableStatement = addDefinitions();

    createTableStatement;
  }

  def addDefinitions(): List[String] = {
    if (hasUniquePrimaryIndex()) {
      (columnNames zip columnDefs).map(cc => {
        if (primaryKeys.contains(cc._1)) {
          createTableStatement = (quoteIdentifier(cc._1) + " " + cc._2 + "  NOT NULL") :: createTableStatement
        } else {
          createTableStatement = (quoteIdentifier(cc._1) + " " + cc._2) :: createTableStatement
        }
      })
    } else {
      (columnNames zip columnDefs).map(cc => createTableStatement = (quoteIdentifier(cc._1) + " " + cc._2) :: createTableStatement)
    }
    createTableStatement
  }

  def quoteIdentifier(colName: String): String = {
    s""""$colName""""
  }

  /**
    * PRIMARY KEY IN TERADATA IS ACTUALLY A UNIQUE PRIMARY INDEX WITH NON ACCEPTANCE  OF
    * A NULL VALUE
    **/
  def addPrimaryKey(): String = {

    if (hasUniquePrimaryIndex)
      primaryIndex = String.format(" UNIQUE PRIMARY INDEX( %s )", joinField(primaryKeys.toList, ","))

    primaryIndex
  }

  private def hasUniquePrimaryIndex(): Boolean = primaryKeys != null && primaryKeys.length != 0

  def joinField(createTableStatement: List[String], s: String): String = createTableStatement.mkString(s)
}


text:
<?php

$config = [
    'components' => [
        'request' => [
            // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
            'cookieValidationKey' => '',
        ],
        'assetManager' => [
            'bundles' => [
                'frontend\assets\HighlightAsset' => [
                    'selector'   => '.hl-code',
                    'sourcePath' => '@frontend/web/plugins/highlight/'
                ],
                'frontend\assets\MaterialDesignIconsAsset' => [
                    'sourcePath' => '@frontend/web/plugins/material-design-icons/'
                ],
                'frontend\assets\MaterializeAsset' => [
                    'sourcePath' => '@frontend/web/plugins/materialize/'
                ],
            ]
        ],
    ],
];

if (!YII_ENV_TEST) {
    // configuration adjustments for 'dev' environment
    $config['bootstrap'][] = 'debug';
    $config['modules']['debug'] = [
        'class' => 'yii\debug\Module',
    ];
    $config['bootstrap'][] = 'gii';
    $config['modules']['gii'] = [
        'class' => 'yii\gii\Module',
    ];
}

return $config;


text:
<?php

namespace Iag\SwitchBundle\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;

class SwitchPilhaType extends AbstractType
{
    /**
     * @param FormBuilderInterface $builder
     * @param array $options
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('hostname')
            ->add('numPortas', null, array(
                'label'=> 'Número de portas'
            ))
            ->add('marca')
            ->add('patrimonio')
            ->add('pilhaFisica', null, array(
                'label' => 'Posição na pilha fisica'
            ))
            ->add('posicaoPilhaLogica', null, array(
                'label' => 'Posição na pilha lógica',
            ))
            ->add('pilhaLogica', 'hidden', array(
                'label'=> 'Pilha lógica',
            ))
        ;
    }

    /**
     * @param OptionsResolverInterface $resolver
     */
    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        $resolver->setDefaults(array(
            'data_class' => 'Iag\SwitchBundle\Entity\SwitchPilha'
        ));
    }

    /**
     * @return string
     */
    public function getName()
    {
        return 'iag_switchbundle_switchpilha';
    }
}


text:
goog.provide('ngeo.DataSources');
goog.require('ngeo');

goog.require('ol.Collection');

ngeo.module.value('ngeoDataSources', new ol.Collection());

/**
 * @typedef {ol.Collection.<ngeo.DataSource>}
 */
ngeo.DataSources;


text:
module Pilgrim
  class ApplicationController < ActionController::Base

  end
end


text:
enyo.kind({
	name: "moon.sample.ProgressSample",
	classes: "moon enyo-unselectable enyo-fit",
	components: [
		{kind: "moon.Divider", content: "Progress Bars"},
		{kind: "moon.ProgressBar", progress: 25},
		{kind: "moon.ProgressBar", progress: 25, bgProgress: 75},
		{kind: "moon.ProgressBar", progress: 50, barClasses: "moon-sample-green"},
		{kind: "moon.ProgressBar", progress: 50, barClasses: "moon-sample-red"},
		{tag: "br"},
		{kind: "moon.InputDecorator", style: "margin-right:10px;", components: [
			{kind: "moon.Input", placeholder: "Value"}
		]},
		{kind: "moon.Button", content:"Set", small:true, classes:"moon-sample-spaced-button", ontap: "changeValue"},
		{kind: "moon.Button", content:"-", small:true, classes:"moon-sample-spaced-button", ontap: "decValue"},
		{kind: "moon.Button", content:"+", small:true, classes:"moon-sample-spaced-button", ontap: "incValue"},
		{tag: "br"},
		{tag: "br"},
		{style: "width:240px;", components: [
			{name: "animateSetting", kind: "moon.CheckboxItem", checked: true, content: "Animated"}
		]}
	],
	changeValue: function(inSender, inEvent) {
		for (var i in this.$) {
			if (this.$[i].kind == "moon.ProgressBar") {
				if (this.$.animateSetting.getChecked()) {
					this.$[i].animateProgressTo(this.$.input.getValue());
				} else {
					this.$[i].setProgress(this.$.input.getValue());
				}
			}
		}
	},
	incValue: function() {
		this.$.input.setValue(Math.min(parseInt(this.$.input.getValue() || 0, 10) + 10, 100));
		this.changeValue();
	},
	decValue: function() {
		this.$.input.setValue(Math.max(parseInt(this.$.input.getValue() || 0, 10) - 10, 0));
		this.changeValue();
	}
});


text:
#include <types.h>
#include "phy_int.h"

extern const struct phytbl_info dot11lcnphytbl_rx_gain_info_rev0[];
extern const u32 dot11lcnphytbl_rx_gain_info_sz_rev0;
extern const struct phytbl_info dot11lcn_sw_ctrl_tbl_info_4313;
extern const struct phytbl_info dot11lcn_sw_ctrl_tbl_info_4313_epa;
extern const struct phytbl_info dot11lcn_sw_ctrl_tbl_info_4313_epa_combo;
extern const struct phytbl_info dot11lcn_sw_ctrl_tbl_info_4313_bt_epa;
extern const struct phytbl_info dot11lcn_sw_ctrl_tbl_info_4313_bt_epa_p250;

extern const struct phytbl_info dot11lcnphytbl_info_rev0[];
extern const u32 dot11lcnphytbl_info_sz_rev0;

extern const struct phytbl_info dot11lcnphytbl_rx_gain_info_2G_rev2[];
extern const u32 dot11lcnphytbl_rx_gain_info_2G_rev2_sz;

extern const struct phytbl_info dot11lcnphytbl_rx_gain_info_5G_rev2[];
extern const u32 dot11lcnphytbl_rx_gain_info_5G_rev2_sz;

extern const struct phytbl_info dot11lcnphytbl_rx_gain_info_extlna_2G_rev2[];

extern const struct phytbl_info dot11lcnphytbl_rx_gain_info_extlna_5G_rev2[];

struct lcnphy_tx_gain_tbl_entry {
	unsigned char gm;
	unsigned char pga;
	unsigned char pad;
	unsigned char dac;
	unsigned char bb_mult;
};

extern const struct lcnphy_tx_gain_tbl_entry dot11lcnphy_2GHz_gaintable_rev0[];

extern const struct
lcnphy_tx_gain_tbl_entry dot11lcnphy_2GHz_extPA_gaintable_rev0[];

extern const struct lcnphy_tx_gain_tbl_entry dot11lcnphy_5GHz_gaintable_rev0[];


text:
namespace Humidifier.EC2
{
    using System.Collections.Generic;

    public class TrafficMirrorTarget : Humidifier.Resource
    {
        public override string AWSTypeName
        {
            get
            {
                return @"AWS::EC2::TrafficMirrorTarget";
            }
        }

        /// <summary>
        /// NetworkLoadBalancerArn
        /// http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-trafficmirrortarget.html#cfn-ec2-trafficmirrortarget-networkloadbalancerarn
        /// Required: False
        /// UpdateType: Immutable
        /// PrimitiveType: String
        /// </summary>
        public dynamic NetworkLoadBalancerArn
        {
            get;
            set;
        }

        /// <summary>
        /// Description
        /// http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-trafficmirrortarget.html#cfn-ec2-trafficmirrortarget-description
        /// Required: False
        /// UpdateType: Immutable
        /// PrimitiveType: String
        /// </summary>
        public dynamic Description
        {
            get;
            set;
        }

        /// <summary>
        /// NetworkInterfaceId
        /// http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-trafficmirrortarget.html#cfn-ec2-trafficmirrortarget-networkinterfaceid
        /// Required: False
        /// UpdateType: Immutable
        /// PrimitiveType: String
        /// </summary>
        public dynamic NetworkInterfaceId
        {
            get;
            set;
        }

        /// <summary>
        /// Tags
        /// http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-trafficmirrortarget.html#cfn-ec2-trafficmirrortarget-tags
        /// Required: False
        /// UpdateType: Mutable
        /// Type: List
        /// ItemType: Tag
        /// </summary>
        public List<Tag> Tags
        {
            get;
            set;
        }
    }
}