text:
module("MainMenuLayer", package.seeall)

require("scenes.ChangPassword")--ÐÞ¸ÄÃÜÂë½çÃæ
require("scenes.VIPScene")--vip½çÃæ
require("layers.BasicInfoLayer")--»ù±¾ÐÅÏ¢½çÃæ
require("scenes.MagicScene")--ħÊõ½çÃæ
require("scenes.PlotListScene")--¸±±¾½çÃæ
require("scenes.GameSettingScene")--ÓÎÏ·ÉèÖÃ
require("scenes.HeroScene")--Ó¶±ø½çÃæ
require("scenes.ChatScene")--ÁÄÌì
require("scenes.CompetitiveScene")--¾º¼¼³¡
require("scenes.BagScene")--±³°ü
require("scenes.MailScene")--Ðżþ
require("scenes.CollectionScene")--¼¯ÓÊ
require("scenes.FirendScene")--ºÃÓÑ
require("scenes.WeaponScene")--×°±¸
require("scenes.HuntingScene")--ÁÔÃü
require("scenes.BossScene")--bossÕ½¶·
require("scenes.SoulSkillScene")--»ê¼¼
require("scenes.businessStore")--É̳Ç
require("scenes.RoleBagScene")--Ó¶±ø±³°ü
require("scenes.EmbattleScene")--²¼Õó½çÃæ
require("layers.BroadcastLayer")--¹ã²¥À¸
require("layers.ActiveBarLayer")--»î¶¯Ìõ
require("layers.GMCtrl")--»î¶¯Ìõ
require("scenes.BoxToScene")
require("scenes.TodayToScene") ------ÿÈÕ̽ÏÕ
require("scenes.PrayScene") ------------ Æíµ»½çÃæ
require("scenes.ManorScene")
require("scenes.SoulSkillList")--»ê¼¼Áбí
require("scenes.HeroLvUp")--Ó¶±øÉý¼¶½çÃæ
require("scenes.sendToScene")----Ë;«Á¦½çÃæ
require("scenes.PublicAnnouncementScene") ------¹«¸æϵͳ
require("scenes.RecruitScene") ---- ÕÐļËͺÃÀñ
require("scenes.BSDiscountScene")
require("scenes.DoubleIncome")
require("layers.LvUpNoticeLayer")
require("scenes.StampScenes")  -----¼¯ÓʽçÃæ
require("scenes.LetterScenes") ---- Ðżþϵͳ
require("scenes.ActiveAllScene")---
require("scenes.WorldBossToScene") --- ÊÀ½çboss
require("scenes.TopUpRebate")--- ³äÖµ·µÀû
require("scenes.UpGradeScene") ---- Éý¼¶ÓоªÏ²
require("scenes.TrialScene")--ÊÔÁ·
require("layers.spriteBlessLayer")--¾«Áé×£¸£½çÃæ

local mMessageLayer=nil
local mMessageTable=nil
local topLayerTable={}
 _count = 0

 function getBtnTable()
 	return btnTable
 end

 function getCurrentId()
 	return _currentId
 end

--
-------------------------˽ÓнӿÚ------------------------
--
-- ³õ'»¯×ÊÔ´¡¢³ÉÔ±±äÁ¿
function initResource()
	endContent_width = pWinSize.width
	endContent_height = pWinSize.height*0.135
	endContent_x = 0
	endContent_y = 0

	topContent_width = pWinSize.width
	topContent_height = pWinSize.height*0.16
	topContent_x = 0
	topContent_y = pWinSize.height-topContent_height

	middleContent_width = pWinSize.width
	middleContent_height = pWinSize.height*0.29
	middleContent_x = (pWinSize.width-middleContent_width)/2
	middleContent_y = pWinSize.height*0.2025

	groupContent_width = pWinSize.width*0.9
	groupContent_height = pWinSize.height*0.16
	groupContent_x = (pWinSize.width-groupContent_width)/2
	groupContent_y =  pWinSize.height*0.505

	miniContent_height = pWinSize.height*0.08
	miniContent_width = pWinSize.width
	miniContent_x = 0
	miniContent_y = pWinSize.height-miniContent_height

	MenuId = {

		eChaDang = 52,--A 100
		eBeiBao =27,
		eFuBen = 51,--
		eZhenXing = 2,
		eShangDian = 37,
		eJingJi = 11,

		eYongBing = 47,--A
		eZhuangBei = 48,
		eHunJi = 49,
		eShuiJing = 16,
		eMoShu = 3,
		eXinJian = 53,--A   102
		eSheZhi = 54,--A  103
		eHuoDong = 14,--»î¶¯
		eShangZhen = 104,--ÎÒµÄÕóÓª  ---A
		eShengJi = 50,--Ó¶±øÉý¼¶
		eEnYuan = 9,
		eJiYou = 55,--¼¯ÓÊ

		ePaiYang = 5,
		eChuanCheng=38,

		eLiLian = 56,--ÀúÁ·

		eChaKan = 105,--²é¿´
	}
	_personalInfo = PersonalInfo.getPersonalInfo()

	isGotoLv=false
	isAllowToBasic = true

	btnTable = {}
	topLayerTable={}
end

function setMainSceneId()
	setCurrentScene(MenuId.eChaDang)
	setSelect(MenuId.eChaDang)
end

--µã»÷¶¥²¿ÇøÓòÏìÓ¦
function key_top()
	if isAllowToBasic then
		BasicInfoLayer.pushScene()
	end
end

--µã»÷Ó¶±øÍ·ÏñͼƬÏìÓ¦
function key_hero(pNode, index)

	local tag = pNode
	--[[
	if index then
		tag = index
	else
	--	tag = pNode:getTag()
	    tag = 1
	end
	]]
	local hero_GeneralID = heroInfo.RecordTabel[tag].GeneralID

	setCurrentScene(MenuId.eShangZhen)
	HeroScene.pushScene(hero_GeneralID)
end

function moveTopList(page)
	_nowPage = page+1
end

--×ó°´Å¥µã»÷
function leftAction()
	if _nowPage > 1 then
		topList:turnToPage(_nowPage-2)

	end
end

--ÓÒ°´Å¥µã»÷
function rightAction()
	if _nowPage < _totalPage then
		topList:turnToPage(_nowPage)
	end
end;

-- ÊÍ·Å×ÊÔ´
function releaseResource()
_isGetPlotItem=nil

topShowLayer=nil
miniShowLayer=nil

topLayer=nil
groupLayer=nil

endLayer=nil
middleLayer=nil

miniLayer=nil
mLayer=nil
LvUpNoticeLayer.releaseResource()
BroadcastLayer.releaseResource()
bcLayer=nil
top_value=nil
mini_value=nil
mMessageTable=nil
mMessageLayer=nil
isAllowToBasic=nil
_quickNumLabel=nil
_fightNumLabel=nil
isGuide=nil
topLayerTable={}

   	if schedulerEntry1 then
	 CCDirector:sharedDirector():getScheduler():unscheduleScriptEntry(schedulerEntry1)
	 end
--CCScheduler:sharedScheduler():unscheduleScriptFunc("MainMenuLayer.refreshAll")
end

function setIsShow(topValue, miniValue)
	top_value = topValue
	mini_value = miniValue
	if topLayer then
		topShowLayer:setVisible(top_value)
		topLayer:setVisible(top_value)
		topLayerTable.topBtn:setVisible(top_value)
		isAllowToBasic = top_value
	end
	if miniLayer then
		miniShowLayer:setVisible(mini_value)
		miniLayer:setVisible(mini_value)
	end
end

-- ´´½¨³¡¾°
function init(type, fatherScene)
	initResource()
	mShowType = type
	mScene = fatherScene
	-- Ìí¼ÓÖ÷²ã
	mLayer= CCLayer:create()--CCLayer:create()
	mLayer:setAnchorPoint(PT(0,0))
	mLayer:setPosition(PT(0,0))
	mScene:addChild(mLayer, 0)
	--mLayer:registerOnEnter("MainMenuLayer.refreshWin")

	local touchLayer=CCLayer:create()
	mLayer:addChild(touchLayer, 0)

	--touchLayer:setIsTouchEnabled(true)
--	touchLayer.__CCTouchDelegate__:registerScriptTouchHandler(CCTOUCHBEGAN, "MainMenuLayer.touchBegan")
--	touchLayer.__CCTouchDelegate__:registerScriptTouchHandler(CCTOUCHMOVED, "MainMenuLayer.touchMove")
--	touchLayer.__CCTouchDelegate__:registerScriptTouchHandler(CCTOUCHENDED, "MainMenuLayer.touchEnd")
	if mShowType == nil then
		topContent()
		groupContent()
		middleContent()
		endContent()
		broadcast()
	elseif mShowType == 2 then
		endContent()

		broadcast()
	elseif mShowType == 1 then
		topContent()
		endContent()

		broadcast()
	elseif mShowType == 3 then
		topMiniInfo()
		endContent()

		broadcast()
	elseif mShowType == 4 then
		topMiniInfo()
		topContent()
		setIsShow(false, false)
		broadcast()
		endContent()
	end
   schedulerEntry1 = 	CCDirector:sharedDirector():getScheduler():scheduleScriptFunc(refreshAll, 1, false)
--	CCScheduler:sharedScheduler():scheduleScriptFunc("MainMenuLayer.refreshAll",1,false)--Æô¶¯¼ÆʱÆ÷
	--]]
end
function gotoChatScene()
	_currentId=nil
	ChatScene.init()
end

function touchBegan(e)
	if isGuide then
		GuideLayer.close()
	end
end

function refreshWin()
	_count = 0
	sendAction(1008)
end;

function  refreshAll()
	_count = _count+1
	if _count%30 == 0 then
		sendAction(1008)
		if MainScene.getMainScene() then
			sendAction(9204)
		end
	end
end;
function moveEndList(page)
	page = page+1
	if not isNoTurn then

		isNoTurn = true
		if page > endPage then
			endPage = 2
			isTurnRight = true
			endList:turnToPage(endPage)
		elseif page <= endPage then
			endPage = 1
			isTurnLeft = true
			endList:turnToPage(endPage-1)
		end
	else
		if ( isTurnRight and page == endPage+1 ) or ( isTurnLeft and page == endPage) then
			isNoTurn = false
			isTurnRight = nil
			isTurnLeft = nil
		end
	end
end
--¹¦ÄÜ°´Å¥ÏìÓ¦
function funcAction(pNode,index)
	local tag =index
	if not index then
		 tag=pNode:getTag()
	end
	if tag == _currentId then--Åжϵã»÷µÄÊÇ·ñÊǵ±Ç°½çÃæ
		setSelect(_currentId)
		return
	end
	local runningScene = CCDirector:sharedDirector():getRunningScene()

	if not MenuBtnConfig.getMenuItem(tag) then
		if tag == MenuId.eShuiJing then
			ZyToast.show(runningScene,Language.PROMPT_CRYSTAL)
		else
			ZyToast.show(runningScene,Language.TIP_FUNCTION)
		end
		return
	end

	if tag == MenuId.eYongBing then
		RoleBagScene.pushScene()
	elseif tag == MenuId.eZhuangBei then
		WeaponScene.init()
	elseif tag == MenuId.eHunJi then
		SoulSkillList.pushScene()
	elseif tag == MenuId.eMoShu then
		MagicScene.init()
	elseif tag == MenuId.eShuiJing then
		HuntingScene.init()
	elseif tag == MenuId.eShengJi then
		HeroLvUp.pushScene()
	elseif tag == MenuId.eXinJian then
		LetterScenes.init()
	elseif tag == MenuId.eEnYuan then
		FireScutScene.init()

	elseif tag == MenuId.eSheZhi then
		GameSettingScene.init()
	elseif tag == MenuId.eJiYou then
		StampScenes.init()
-------------------------------------------------------------

	elseif tag == MenuId.eChaDang then
        	MainScene.init()
	elseif tag == MenuId.eBeiBao then
		--spriteBlessLayer.setParent()
		BagScene.init()
	elseif tag == MenuId.eFuBen then
		PlotListScene.init(1)
	--	StampScenes.init()
	elseif tag == MenuId.eZhenXing then
    	EmbattleScene.pushScene()
	---	WorldBossToScene.init()
	elseif tag == MenuId.eShangDian then
		businessStore.pushScene()
	elseif tag == MenuId.eJingJi then
		CompetitiveScene.init()
	elseif tag == MenuId.eHuoDong then
		ActiveBarLayer.init()
	elseif tag == MenuId.eLiLian then
		TrialScene.init()
	end

	setCurrentScene(tag)

	setSelect(_currentId)

end

--¹Ø±ÕËùÓÐÒ³Ãæ
function closeAllLayer()
	if topLayer ~= nil then
		topLayer:getParent():removeChild(topLayer, true)
		topLayer = nil
	end
	if endLayer ~= nil then
		endLayer:getParent():removeChild(endLayer, true)
		endLayer = nil
	end
	if middleLayer ~= nil then
		middleLayer:getParent():removeChild(middleLayer, true)
		middleLayer = nil
	end
	if groupLayer ~= nil then
		groupLayer:getParent():removeChild(groupLayer, true)
		groupLayer = nil
	end

	if miniLayer ~= nil then
		miniLayer:getParent():removeChild(miniLayer, true)
		miniLayer = nil
	end

	BroadcastLayer.releaseResource()

	if mLayer ~= nil then
		mLayer:getParent():removeChild(mLayer, true)
		mLayer = nil
	end

end

----------
--¶¥²¿¹ã²¥ÏÔʾÇø
function broadcast()
	BroadcastLayer.releaseResource()
	local endLine = CCSprite:create(P(Image.image_under_Line));
	local layer = BroadcastLayer.init(mScene)
	layer:setAnchorPoint(PT(0,0))
	layer:setPosition(PT(pWinSize.width/2-layer:getContentSize().width/2,
						pWinSize.height*0.97))
	mLayer:addChild(layer, 1)

	bcLayer = layer
end;

---------------------------------
--¶¥²¿ÇøÓò
function topContent()
	if topLayer ~= nil then
		topLayer:getParent():removeChild(topLayer, true)
		topLayer = nil
	end
	local layer = CCLayer:create()
	layer:setAnchorPoint(PT(0,0))
	layer:setPosition(PT(topContent_x, topContent_y))
	mLayer:addChild(layer, 1)
	topLayer = layer

	local imageBg = CCSprite:create(P("mainUI/list_1000.png"));
	imageBg:setScaleX(topContent_width/imageBg:getContentSize().width)
	imageBg:setScaleY(topContent_height/imageBg:getContentSize().height)
	imageBg:setAnchorPoint(PT(0,0))
	imageBg:setPosition(PT(0, 0))
	layer:addChild(imageBg, 0)

	local topBtn=ZyButton:new(Image.image_transparent,Image.image_transparent)
	topBtn:setScaleX(topContent_width/topBtn:getContentSize().width)
	topBtn:setScaleY(topContent_height/topBtn:getContentSize().height)
	topBtn:registerScriptHandler(key_top)
	topBtn:setAnchorPoint(PT(0,0))
	topBtn:setPosition(PT(0,0))
	topBtn:addto(layer, 0)
	topLayerTable.topBtn=topBtn
	if top_value then
		topBtn:setVisible(top_value)
		topLayer:setVisible(top_value)

	end

	local topLine = CCSprite:create(P(Image.image_top_line));
	topLine:setScaleX(topContent_width/topLine:getContentSize().width)
	topLine:setAnchorPoint(PT(0,1))
	topLine:setPosition(PT(0, 0))
	layer:addChild(topLine, 0)

	topShow()

end

function topShow()
	if  topShowLayer then
		topShowLayer:getParent():removeChild(topShowLayer, true)
		topShowLayer = nil
	end
	local layer = CCLayer:create()
	topLayer:addChild(layer, 0)
	topShowLayer = layer

	if top_value then
		topShowLayer:setVisible(top_value)
	end

	local startX = pWinSize.width*0.05
	--ÐÕÃû±³¾°
	local nameBg = CCSprite:create(P("mainUI/list_1001_2.png"));
	local startY=topContent_height-nameBg:getContentSize().height-pWinSize.height*0.03
	nameBg:setAnchorPoint(PT(0,0))
	nameBg:setPosition(PT(startX,startY))
	layer:addChild(nameBg, 0)
	local nameLabel = nil
	if _personalInfo._NickName then
		nameLabel = CCLabelTTF:create(_personalInfo._NickName, FONT_NAME, FONT_SM_SIZE)
		nameLabel:setAnchorPoint(PT(0,0))
		nameLabel:setPosition(PT(nameBg:getPosition().x+(nameBg:getContentSize().width-nameLabel:getContentSize().width)*0.5, nameBg:getPosition().y+(nameBg:getContentSize().height-nameLabel:getContentSize().height)*0.5))
		layer:addChild(nameLabel, 0)
	end

	----Íæ¼ÒVIPͼ±êÏÔʾ
	if _personalInfo._VipLv ~= nil and _personalInfo._VipLv ~= 0 and isShowVip() then
			VIPImg = string.format("button/vip_%s.png",_personalInfo._VipLv)
			local VipNowImg = CCSprite:create(P(VIPImg))
			nameLabel:setPosition(PT(nameBg:getPosition().x+(nameBg:getContentSize().width-nameLabel:getContentSize().width-VipNowImg:getContentSize().width-SX(5))*0.5, nameBg:getPosition().y+(nameBg:getContentSize().height-nameLabel:getContentSize().height)*0.5))

			VipNowImg:setAnchorPoint(PT(0,0))
			VipNowImg:setPosition(PT(nameLabel:getPosition().x+nameLabel:getContentSize().width+SX(5),nameLabel:getPosition().y+nameLabel:getContentSize().height*0.5-VipNowImg:getContentSize().height*0.5))
			layer:addChild(VipNowImg,0)
	end
	startY=nameBg:getPosition().y
	--µÈ¼¶±³¾°
	local levelBg = CCSprite:create(P("mainUI/list_1001_1.png"));
	levelBg:setAnchorPoint(PT(0,0))
	levelBg:setPosition(PT(nameBg:getPosition().x+nameBg:getContentSize().width*0.9, nameBg:getPosition().y))
	layer:addChild(levelBg, 0)
	if _personalInfo._UserLv then
		local levelStr = Language.ROLE_LEVEL..":".._personalInfo._UserLv
		local levelLabel = CCLabelTTF:create(levelStr, FONT_NAME, FONT_SM_SIZE)
		levelLabel:setAnchorPoint(PT(0,0))
		levelLabel:setPosition(PT(levelBg:getPosition().x+levelBg:getContentSize().width*0.25, levelBg:getPosition().y+(levelBg:getContentSize().height-levelLabel:getContentSize().height)*0.5))
		layer:addChild(levelLabel, 0)
	end

	local barBg = CCSprite:create(P(Image.image_exp_bar));

	--¾Ñé±³¾°
	local expBg = CCSprite:create(P("mainUI/list_1001_3.png"));
	expBg:setAnchorPoint(PT(0,0))
	expBg:setPosition(PT(startX, startY-expBg:getContentSize().height-SY(1)))
	layer:addChild(expBg, 0)
	startY=expBg:getPosition().y
	--¾ÑéÎÄ×ÖͼƬ
	local expBar = CCSprite:create(P("mainUI/list_1008.png"));
	expBar:setAnchorPoint(PT(0,0))
	expBar:setPosition(PT(startX+expBg:getContentSize().width*0.075, expBg:getPosition().y+expBg:getContentSize().height*0.1))
	layer:addChild(expBar, 0)
	--¾ÑéÌõ
	local pos = PT(expBg:getPosition().x+expBg:getContentSize().width*0.22, expBg:getPosition().y+expBg:getContentSize().height*0.11)
	createBar("mainUI/list_1004.9.png", _personalInfo._HonourNum, _personalInfo._NextHonourNum, pos, layer)

	--¾«Á¦±³¾°
	local energyBg = CCSprite:create(P("mainUI/list_1001_3.png"));
	energyBg:setAnchorPoint(PT(0,0))
	energyBg:setPosition(PT(startX, startY-energyBg:getContentSize().height-SY(1)))
	layer:addChild(energyBg, 0)
	--¾ÑéÎÄ×ÖͼƬ
	local expBar = CCSprite:create(P("mainUI/list_1009.png"));
	expBar:setAnchorPoint(PT(0,0))
	expBar:setPosition(PT(startX+energyBg:getContentSize().width*0.075, energyBg:getPosition().y+energyBg:getContentSize().height*0.1))
	layer:addChild(expBar, 0)
	--¾«Á¦Ìõ
	local pos = PT(energyBg:getPosition().x+energyBg:getContentSize().width*0.22, energyBg:getPosition().y+energyBg:getContentSize().height*0.11)
	createBar("mainUI/list_1005.9.png", _personalInfo._EnergyNum, _personalInfo._MaxEnergyNum, pos, layer)

	--¾§Ê¯±³¾°

	local goldBg = CCSprite:create(P("mainUI/list_1002.png"));
	startY=topContent_height-goldBg:getContentSize().height-pWinSize.height*0.03
	goldBg:setAnchorPoint(PT(0,0))
	goldBg:setPosition(PT(pWinSize.width*0.7, startY))
	layer:addChild(goldBg, 0)
		local item,itemSize = imageMoney("mainUI/list_1006.png", _personalInfo._GoldNum)
		item:setPosition(PT(goldBg:getPosition().x+goldBg:getContentSize().width*0.1, goldBg:getPosition().y+(goldBg:getContentSize().height-itemSize.height)*0.5))
		layer:addChild(item, 0)

	--½ð±Ò±³¾°
	local goinBg = CCSprite:create(P("mainUI/list_1002.png"));
	goinBg:setAnchorPoint(PT(0,0))
	goinBg:setPosition(PT(goldBg:getPosition().x, energyBg:getPosition().y))
	layer:addChild(goinBg, 0)
		local item,itemSize = imageMoney("mainUI/list_1007.png", _personalInfo._GameCoin)
		item:setPosition(PT(goinBg:getPosition().x+goinBg:getContentSize().width*0.1, goinBg:getPosition().y+(goinBg:getContentSize().height-itemSize.height)*0.5))
		layer:addChild(item, 0)

end

--ͼƬ×öµ¥Î»  + ¼Û¸ñ
function imageMoney(image, num)

	local layer = CCLayer:create()
		local sprite = CCSprite:create(P(image));
		sprite:setAnchorPoint(PT(0,0))
		sprite:setPosition(PT(0,0))
		layer:addChild(sprite, 0)

		local numLabel = CCLabelTTF:create(num or "", FONT_NAME, FONT_SMM_SIZE)
		numLabel:setAnchorPoint(PT(0,0))
		numLabel:setPosition(PT(sprite:getPosition().x+sprite:getContentSize().width, (sprite:getContentSize().height-numLabel:getContentSize().height)*0.5))
		layer:addChild(numLabel, 0)

		local itemSize = SZ(numLabel:getPosition().x+numLabel:getContentSize().width, sprite:getContentSize().height)

	return layer,itemSize
end

---´´½¨¾ÑéÌõ
function  createBar(picPath,currentValue,maxValue,pos,father)
	local barBg = CCSprite:create(P(Image.image_exp_bar));
	barBg:setAnchorPoint(PT(0,0))
	barBg:setPosition(PT(pos.x, pos.y))
	father:addChild(barBg, 0)

	local  proBar = CCSprite:create(P(picPath))
	if maxValue==0 then
		maxValue=100
	end
    currentValue=currentValue or 0
    maxValue=maxValue or 1
	local scale=currentValue/maxValue
	if scale>1 then
		scale=1
	end

	local width = barBg:getContentSize().width-SX(2)
	draw_w=width*scale  --ʵ¼Ê»æÖƳ¤¶È

	if draw_w< proBar:getContentSize().width then
		draw_w= proBar:getContentSize().width
	end
	proBar:setScaleX(draw_w/proBar:getContentSize().width)
	proBar:setAnchorPoint(PT(0,0))
	proBar:setPosition(PT(pos.x+SX(1),pos.y))
	father:addChild(proBar,0)
	if currentValue==0 then
		proBar:setVisible(false)
	end

	local numStr = currentValue.."/"..maxValue
	local numLabel = CCLabelTTF:create(numStr, FONT_NAME, FONT_SM_SIZE)
	numLabel:setAnchorPoint(PT(0.5,0))
	numLabel:setPosition(PT(pos.x+barBg:getContentSize().width*0.5, pos.y+barBg:getContentSize().height))
	father:addChild(numLabel, 0)

	return proBar
end;

-------------------------------
--ÎÒµÄÕóÓª
function groupContent()
	if groupLayer ~= nil then
		groupLayer:getParent():removeChild(groupLayer, true)
		groupLayer = nil
	end

	local layer = CCLayer:create()
	layer:setAnchorPoint(PT(0,0))
	layer:setPosition(PT(0, groupContent_y))
	mLayer:addChild(layer, 1)

	groupLayer = layer

	local imageBg = CCSprite:create(P("mainUI/list_1010.png"));
	local scale = pWinSize.width/imageBg:getContentSize().width
	imageBg:setScale(scale)
--	imageBg:setScaleY(groupContent_height/imageBg:getContentSize().height)
	imageBg:setAnchorPoint(PT(0,0))
	imageBg:setPosition(PT(0,0))
	layer:addChild(imageBg, 0)

	groupContent_height = imageBg:getContentSize().height*scale*0.48
	--ÎÒµÄÕóÓªÁбí
	local heroListSize = SZ(groupContent_width, groupContent_height)
	list = ScutCxList:node(heroListSize.width/5, ccc4(24, 24, 24, 0), heroListSize)
	list:setHorizontal(true)
	list:setAnchorPoint(PT(0, 0))
	list:setTouchEnabled(true)
	local pos_y = imageBg:getContentSize().height*scale*0.225
	list:setPosition(PT(groupContent_x, pos_y))
	layer:addChild(list,0)
	heroList = list

	local item_y = imageBg:getContentSize().height*scale*0.1
	local item,label = imageAndLabel("title/list_1013.png", _personalInfo._TalPriority)
	item:setPosition(PT(pWinSize.width*0.1, item_y))
	layer:addChild(item, 0)
	_quickNumLabel = label

	local item,label = imageAndLabel("title/list_1025.png", _personalInfo._CombatNum)
	item:setPosition(PT(pWinSize.width*0.5, item_y))
	layer:addChild(item, 0)
	_fightNumLabel = label

end

--ͼƬ×öµ¥Î»  + ¼Û¸ñ
function imageAndLabel(image, num)

	local layer = CCLayer:create()
	local titleSprite = CCSprite:create(P(image));
	titleSprite:setAnchorPoint(PT(0,0))
	titleSprite:setPosition(PT(0,0))
	layer:addChild(titleSprite, 0)

	local bgSize = SZ(pWinSize.width*0.15, pWinSize.height*0.05)
	local numBg = CCSprite:create(P("common/list_1037.9.png"));
	numBg:setScaleX(bgSize.width/numBg:getContentSize().width)
	numBg:setAnchorPoint(PT(0,0))
	numBg:setPosition(PT(titleSprite:getPosition().x+titleSprite:getContentSize().width+pWinSize.width*0.015,titleSprite:getContentSize().height*0.5-numBg:getContentSize().height*0.5))
	layer:addChild(numBg, 0)

	local numLabel = CCLabelTTF:create(num or "", FONT_NAME, FONT_SM_SIZE)
	numLabel:setAnchorPoint(PT(0.5,0.5))
	numLabel:setPosition(PT(numBg:getPosition().x+bgSize.width*0.5, numBg:getPosition().y+numBg:getContentSize().height*0.5))
	layer:addChild(numLabel, 0)

	return layer,label
end

--ÎÒµÄÕóÓªÐÅÏ¢
function showHero()
	local list = heroList
	list:clear()
	local row = 5
	local nAmount = _personalInfo._TotalBattle

    if not nAmount then
        return
    end
	btnTable.hero={}
	for i=1,nAmount do
	  	local listItem = ScutCxListItem:itemWithColor(ccc3(25,57,45))
		listItem:setOpacity(0)
		list:addListItem(listItem,false)

		local layer = CCLayer:create()
		local image = nil
		local name = nil
		local level = nil
		local tag = i
		local actionPath = MainMenuLayer.key_embattle
		local qualityType = nil
		local ishero  = false

		local heroDetail = heroInfo.RecordTabel[tag]
		if heroDetail then
			image = string.format("smallitem/%s.png", heroDetail.HeadID)
			level = heroDetail.GeneralLv
			actionPath = key_hero
			ishero = true
			qualityType = heroDetail.GeneralQuality
		end

		local headItem,menuItem = creatHeadItem(image, level, name, qualityType,tag, actionPath)
		local pos_x = list:getRowWidth()*0.5-headItem:getContentSize().width*0.5
		local pos_y = list:getContentSize().height*0.18
		headItem:setAnchorPoint(PT(0,0))
		headItem:setPosition(PT(pos_x, pos_y))
		layer:addChild(headItem, 0)

		if ishero then
			--btnTable.hero[#btnTable.hero+1]=headItem
		end
		if heroDetail and heroDetail.GeneralID == _personalInfo._GeneralID then
			btnTable.guideHero	= menuItem
		end

		local layout = CxLayout()
		layout.val_x.t = ABS_WITH_PIXEL
		layout.val_y.t = ABS_WITH_PIXEL
		layout.val_x.t  = 0
		layout.val_y.t  = 0
		listItem:addChildItem(layer, layout)
	end

		--¾«Áé×£¸£ÏµÍ³
	spriteBlessLayer.createActionLayer(mScene,PersonalInfo:getPersonalInfo()._WizardNum)

	judgeIsGuide()

end

function judgeIsGuide()
	if GuideLayer.judgeIsGuide(1) and not PublishNoitc then
		isGuide = true
		GuideLayer.setScene(mScene)
		GuideLayer.init()
	else
		isGuide = nil
	end
end

function setIsPublish(value)
	PublishNoitc = value
end

--´´½¨Ó¶±øͼƬ
function creatHeadItem(image, level, name, qualityType, tag, actionPath)
	-- ±³¾°
	local bgPic = Image.image_zhenfa_beijing
	if qualityType then
		bgPic = getQualityBg(qualityType, 1)
	end
	local menuItem = CCMenuItemImage:create(P(bgPic), P(bgPic))
	local btn = CCMenu:createWithItem(menuItem)
	btn:setAnchorPoint(PT(0,0))
	menuItem:setAnchorPoint(PT(0,0))
	if tag~= nil and tag~=-1 then
		menuItem:setTag(tag)
	end

	--ÉèÖÃËõ·Å
	if nScale == nil then
		nScale = 1
	end
	menuItem:setScale(nScale)
	btn:setContentSize(SZ(menuItem:getContentSize().width*nScale,menuItem:getContentSize().height*nScale))

	--ÉèÖûص÷
	if actionPath ~= nil then
		menuItem:registerScriptTapHandler(actionPath)
	end

	-- ËõÂÔͼ
	if image ~= nil and image ~= "" then
		local imageLabel = CCSprite:create(P(image))
		imageLabel:setAnchorPoint(CCPoint(0.5, 0.5))
		imageLabel:setPosition(PT(menuItem:getContentSize().width*0.5,menuItem:getContentSize().height*0.5))
		menuItem:addChild(imageLabel,0)
	end
	--µÈ¼¶
	if level ~= nil then
		--µÈ¼¶±³¾°
		local levelBg = CCSprite:create(P("common/list_1011.png"))
		levelBg:setAnchorPoint(CCPoint(0.5, 0.5))
		levelBg:setPosition(PT(menuItem:getContentSize().width*0.5, -menuItem:getContentSize().height*0.1))
		menuItem:addChild(levelBg,0)

		local levelLabel = CCLabelTTF:create("Lv"..level, FONT_NAME, FONT_SM_SIZE-2)
		levelLabel:setAnchorPoint(CCPoint(0.5, 0.5))
		levelLabel:setPosition(PT(levelBg:getPosition().x, levelBg:getPosition().y))
		menuItem:addChild(levelLabel, 0)
	end

	if name ~= nil then
		local nameLabel = CCLabelTTF:create(name, FONT_NAME, FONT_SM_SIZE-2)
		nameLabel:setAnchorPoint(CCPoint(0, 0))
		nameLabel:setPosition(PT(SX(3),menuItem:getContentSize().height-nameLabel:getContentSize().height-SY(3)))
		menuItem:addChild(nameLabel,1)
	end

	return btn,menuItem

end;

--µã»÷¿Õ°×Ó¶±ø
function key_embattle()

	setCurrentScene(MenuId.eZhenXing)

	EmbattleScene.pushScene()
end;

---------------------------
--Öм䰴ťÇøÓò
function middleContent()
	if middleLayer ~= nil then
		middleLayer:getParent():removeChild(middleLayer, true)
		middleLayer = nil
	end

	local layer = CCLayer:create()
	layer:setAnchorPoint(PT(0,0))
	layer:setPosition(PT(middleContent_x, middleContent_y))
	mLayer:addChild(layer, 1)

	middleLayer = layer

	--°´Å¥Áбí
	local topListSize = SZ(middleContent_width*0.8, middleContent_height)
	list = ScutCxList:node(topListSize.width, ccc4(24, 24, 24, 0), topListSize)
	list:setHorizontal(true)
	list:setPageTurnEffect(true)
	list:setAnchorPoint(PT(0, 0))
	list:setPosition(PT((middleContent_width-topListSize.width)*0.5, 0))
	list:registerLoadEvent(moveTopList)
	layer:addChild(list,0)
	list:setTouchEnabled(true)
	topList = list

	funcTabel ={
		{ id = MenuId.eYongBing, strPic = "title/list_1016.png"},--Ó¶±ø
		{ id = MenuId.eZhuangBei, strPic = "title/list_1017.png"},--×°±¸
		{ id = MenuId.eHunJi, strPic = "title/list_1018.png"},--»ê¼¼
		{ id = MenuId.eMoShu, strPic = "title/list_1021.png"},--ħÊõ
		{ id = MenuId.eShuiJing, strPic = "title/list_1019.png"},--Ë®¾§
		{ id = MenuId.eShengJi, strPic = "title/list_1020.png"},--Éý¼¶
		{ id = MenuId.eEnYuan, strPic = "title/list_1162.png"},--¶÷Ô¹
		{ id = MenuId.eSheZhi, strPic = "title/list_1093.png"},--ÉèÖÃ
	--	{ id = MenuId.eXinJian, strPic = "title/list_1092.png"},--Ðżþ
		{ id = MenuId.eJiYou, strPic = "title/list_1212.png"},--¼¯ÓÊ

	}

		MenuBtnConfig.setMenuItem(MenuId.eYongBing)
		MenuBtnConfig.setMenuItem(MenuId.eSheZhi)

		local line = 4
		local row = 2
		local nAmount = math.ceil(#funcTabel/(line*row))
		btnTable.middle = {}

		if not _nowPage then
			_nowPage = 1
		end
		local isGuide,GuideID,step = GuideLayer.getIsGuide()
		if GuideID == 1009 and (step == 1 or step == 2) and _nowPage ~= 1 then
			_nowPage = 1
		end

		_totalPage = nAmount

		for k=1,nAmount do
		  	local listItem = ScutCxListItem:itemWithColor(ccc3(25,57,45))
			listItem:setOpacity(0)
			list:addListItem(listItem,false)
			local funcBtnLayer = CCLayer:create()

			--°´Å¥ ÅÅÐò ´ÓÉϵ½Ï   ´Ó×óµ½ÓÒ   ÏÈÉÏÏ ºó×óÓÒ
			for i=1,line*row do
				local num = (k-1)*(line*row)+i
				if funcTabel[num] then
					local funcBtn = ZyButton:new("mainUI/list_1026_1.png","mainUI/list_1026_2.png")
					local tag = funcTabel[num].id
					funcBtn:setTag(tag)
					funcBtn:registerScriptHandler(funcAction)
					funcBtn:setAnchorPoint(PT(0,0))

					local image = funcTabel[num].strPic
					local strImage = CCSprite:create(P(image));
					strImage:setAnchorPoint(PT(0,0))
					strImage:setPosition(PT((funcBtn:getContentSize().width-strImage:getContentSize().width)*0.5, (funcBtn:getContentSize().height-strImage:getContentSize().height)*0.5))
					funcBtn:addChild(strImage, 0)

					local startX = topList:getContentSize().width/row*(math.floor((i-1)/line)+0.5)-funcBtn:getContentSize().width*0.5
					local startY = topList:getContentSize().height/line*(line-(i-1)%line-0.5)-funcBtn:getContentSize().height*0.5
					funcBtn:setPosition(PT(startX, startY))
					funcBtn:addto(funcBtnLayer, 0)

					btnTable.middle[#btnTable.middle+1] = funcBtn
				end
			end
			--[[
			local pageLabel = CCLabelTTF:create(k.."/"..nAmount, FONT_NAME, FONT_SM_SIZE)
			pageLabel:setAnchorPoint(PT(0.5,0))
			pageLabel:setPosition(PT(topList:getContentSize().width*0.5, topList:getContentSize().height*0.05))
			funcBtnLayer:addChild(pageLabel, 0)
			--]]

			local layout = CxLayout()
			layout.val_x.t = ABS_WITH_PIXEL
			layout.val_y.t = ABS_WITH_PIXEL
			layout.val_x.t  = 0
			layout.val_y.t  = 0
			listItem:addChildItem(funcBtnLayer, layout)

		end

		if nAmount > 1 then
			local leftBtn = ZyButton:new(Image.image_LeftButtonNorPath)
			leftBtn:registerScriptHandler(leftAction)
			leftBtn:setAnchorPoint(PT(0,0))
			leftBtn:setPosition(PT(list:getPosition().x-leftBtn:getContentSize().width, list:getPosition().y+list:getContentSize().height*0.5-leftBtn:getContentSize().height*0.5))
			leftBtn:addto(layer, 0)

			local rightBtn = ZyButton:new(Image.image_rightButtonNorPath)
			rightBtn:registerScriptHandler(rightAction)
			rightBtn:setAnchorPoint(PT(0,0))
			rightBtn:setPosition(PT(list:getPosition().x+list:getContentSize().width, list:getPosition().y+list:getContentSize().height*0.5-leftBtn:getContentSize().height*0.5))
			rightBtn:addto(layer, 0)

		end

	 creatLetter()

	 topList:turnToPage(_nowPage-1)
end

--Ðżþ
function creatLetter()
		---   Ðżþ°´Å¥½ÓÈë
		local layer = middleLayer

		local letterBtn = ZyButton:new("button/list_1213.png")
		local pos =  PT(pWinSize.width*0.98-letterBtn:getContentSize().width, pWinSize.height*0.25)
		local tag = MenuId.eXinJian
		letterBtn:setTag(tag)
		letterBtn:registerScriptHandler(funcAction)
		letterBtn:setAnchorPoint(PT(0,0))
		letterBtn:setPosition(pos)
		letterBtn:addto(layer, 1)

		if _personalInfo._unReadCount and _personalInfo._unReadCount > 0 then
			letterBtn:setVisible(false)

			--ÉÁ˸
			local mailSprite=Human:new()
			mailSprite:createNpc(layer,"xinfeng",nil,nil,pos.x+letterBtn:getContentSize().width*0.5,pos.y, 1)

			--͸Ã÷°´Å¥
			local unTouchBtn =  ZyButton:new(Image.image_transparent,Image.image_transparent)
			unTouchBtn:setScaleX(letterBtn:getContentSize().width/unTouchBtn:getContentSize().width)
			unTouchBtn:setScaleY(letterBtn:getContentSize().height/unTouchBtn:getContentSize().height)
			unTouchBtn:setAnchorPoint(PT(0,0))
			unTouchBtn:setPosition(PT(pos.x, pos.y))
			unTouchBtn:addto(layer, 0)
			unTouchBtn:setTag(tag)
			unTouchBtn:registerScriptHandler(funcAction)

		end

end

-------------------------
--µ×²¿ÇøÓò  ²Ëµ¥°´Å¥
function endContent()
	if endLayer ~= nil then
		endLayer:getParent():removeChild(endLayer, true)
		endLayer = nil
	end

	local layer = CCLayer:create()
	layer:setAnchorPoint(PT(0,0))
	layer:setPosition(PT(endContent_x, endContent_y))
	mLayer:addChild(layer, 1)
	endLayer = layer

	--µ×²¿±³¾°
	local imageBg = CCSprite:create(P("mainUI/list_1014.png"));
	imageBg:setScaleY(endContent_height/imageBg:getContentSize().height)
	imageBg:setScaleX(endContent_width/imageBg:getContentSize().width)
	imageBg:setAnchorPoint(PT(0,0))
	imageBg:setPosition(PT(0, 0))
	layer:addChild(imageBg, 0)

	--Éϱ߿ò
	local endLine = CCSprite:create(P(Image.image_under_Line));
	endLine:setScaleX(endContent_width/endLine:getContentSize().width)
	endLine:setAnchorPoint(PT(0,0))
	endLine:setPosition(PT(0, endContent_height))
	layer:addChild(endLine, 0)

	local leftImage = CCSprite:create(P("mainUI/list_1142_1.png"));
	leftImage:setAnchorPoint(PT(1,1))
	leftImage:setPosition(PT(endContent_width/6, endContent_height))
	layer:addChild(leftImage, 0)

	local rightImage = CCSprite:create(P("mainUI/list_1142_2.png"));
	rightImage:setAnchorPoint(PT(1,1))
	rightImage:setPosition(PT(endContent_width, endContent_height))
	layer:addChild(rightImage, 0)

	menuTabel ={
		{ id = MenuId.eChaDang, strPic = "mainUI/list_1027_1.png",downPic="mainUI/list_1027_2.png"},
		{ id = MenuId.eBeiBao, strPic = "mainUI/list_1031_1.png",downPic="mainUI/list_1031_2.png"},
		{ id = MenuId.eFuBen, strPic = "mainUI/list_1029_1.png",downPic="mainUI/list_1029_2.png"},
		{ id = MenuId.eZhenXing, strPic = "mainUI/list_1028_1.png",downPic="mainUI/list_1028_2.png"},
		{ id = MenuId.eShangDian, strPic = "mainUI/list_1030_1.png",downPic="mainUI/list_1030_2.png"},
		{ id = MenuId.eHuoDong, strPic = "mainUI/list_1139_1.png",downPic="mainUI/list_1139_2.png"},
		{ id = MenuId.eLiLian, strPic = "mainUI/list_2065_1.png",downPic="mainUI/list_2065_2.png"},	--ÀúÁ·
		{ id = MenuId.eJingJi, strPic = "mainUI/list_1091_1.png",downPic="mainUI/list_1091_2.png"},
	}
	MenuBtnConfig.setMenuItem(MenuId.eChaDang)

	btnTable.menu={}

	local menuNum = 6--
	for i=1,1 do
		local image = menuTabel[i].strPic
		local imageDown = menuTabel[i].downPic
		local munuBtn=ZyButton:new(image,imageDown,imageDown)
		munuBtn:setTag(menuTabel[i].id)
		munuBtn:registerScriptHandler(funcAction)
		munuBtn:setAnchorPoint(PT(0,0))
		local startX = endContent_width/menuNum*(i-0.5)-munuBtn:getContentSize().width*0.5
		local startY = (endContent_height-munuBtn:getContentSize().height)*0.5
		munuBtn:setPosition(PT(startX, startY))
		munuBtn:addto(layer, 0)

		btnTable.menu[#btnTable.menu+1]=munuBtn
	end

	--°´Å¥Áбí
	local endListSize = SZ(endContent_width/6*5, endContent_height)
	list = ScutCxList:node(endListSize.width/5, ccc4(24, 24, 24, 0), endListSize)
	list:setHorizontal(true)
	list:setAnchorPoint(PT(0, 0))
	list:setPosition(PT(endContent_width/6, 0))
	layer:addChild(list,0)
	list:registerLoadEvent(moveEndList)
	list:setPageTurnEffect(true)
	list:setRecodeNumPerPage (1)
    list:setTouchEnabled(true)
	endList = list

	for i=2,#menuTabel do
	  	local listItem = ScutCxListItem:itemWithColor(ccc3(25,57,45))
		listItem:setOpacity(0)
		list:addListItem(listItem,false)

		local layer = CCLayer:create()

		local image = menuTabel[i].strPic
		local imageDown = menuTabel[i].downPic
		local munuBtn=ZyButton:new(image,imageDown,imageDown)
		munuBtn:setTag(menuTabel[i].id)
		munuBtn:registerScriptHandler(funcAction)
		munuBtn:setAnchorPoint(PT(0,0))
		local startX = list:getRowWidth()*0.5-munuBtn:getContentSize().width*0.5
		local startY = (endContent_height-munuBtn:getContentSize().height)*0.5
		munuBtn:setPosition(PT(startX, startY))
		munuBtn:addto(layer, 0)

		local layout = CxLayout()
		layout.val_x.t = ABS_WITH_PIXEL
		layout.val_y.t = ABS_WITH_PIXEL
		layout.val_x.t  = 0
		layout.val_y.t  = 0
		listItem:addChildItem(layer, layout)

		btnTable.menu[#btnTable.menu+1]=munuBtn
	end
	if not endPage then
		endPage = 1
	else
		if endPage > 1 then
			isTurnRight = true
			isNoTurn = true
			endList:turnToPage(endPage)
		end
	end
end

function setCurrentScene(id)
	_currentId = id
end

function setSelect(id)
	for k,v in ipairs(menuTabel) do
		if id == v.id then
			btnTable.menu[k]:selected()
		else
			btnTable.menu[k]:unselected()
		end
	end
end

--¶¥²¿ËõÂÔÄÚÈÝ
function topMiniInfo()
	if miniLayer ~= nil then
		miniLayer:getParent():removeChild(miniLayer, true)
		miniLayer = nil
	end
	local layer = CCLayer:create()
	layer:setAnchorPoint(PT(0,0))
	layer:setPosition(PT(miniContent_x, miniContent_y))
	mLayer:addChild(layer, 0)
	miniLayer = layer

	if mini_value then
		miniLayer:setVisible(mini_value)
	end
	local imageBg = CCSprite:create(P("common/list_1047.png"));
	imageBg:setScaleX(miniContent_width/imageBg:getContentSize().width)
	imageBg:setScaleY(miniContent_height/imageBg:getContentSize().height)
	imageBg:setAnchorPoint(PT(0,0))
	imageBg:setPosition(PT(0, 0))
	layer:addChild(imageBg, 0)

	local topBtn=ZyButton:new(Image.image_transparent,Image.image_transparent)
	topBtn:setScaleX(pWinSize.width/topBtn:getContentSize().width)
	topBtn:setScaleY(miniContent_height/topBtn:getContentSize().height)
	topBtn:registerScriptHandler(key_top)
	topBtn:setAnchorPoint(PT(0,0))
	topBtn:setPosition(PT(miniContent_x, miniContent_y))
	topBtn:addto(layer, 0)

	showTopMini()
end

function showTopMini()
	if miniShowLayer then
		miniShowLayer:getParent():removeChild(miniShowLayer, true)
		miniShowLayer = nil
	end

	local layer = CCLayer:create()
	layer:setAnchorPoint(PT(0,0))
	layer:setPosition(PT(0, 0))
	miniLayer:addChild(layer, 0)

	miniShowLayer = layer

	if mini_value then
		miniShowLayer:setVisible(mini_value)
	end

	--ÐÕÃû±³¾°
	local startX =0
	local nameBg = CCSprite:create(P("mainUI/list_1001_2.png"));
	nameBg:setAnchorPoint(PT(0,0))
	local height = miniContent_height*0.5-nameBg:getContentSize().height*0.5
	nameBg:setPosition(PT(startX, height))
	layer:addChild(nameBg, 0)
	if _personalInfo._NickName then
		local nameLabel = CCLabelTTF:create(_personalInfo._NickName, FONT_NAME, FONT_SM_SIZE)
		nameLabel:setAnchorPoint(PT(0,0))
		nameLabel:setPosition(PT(nameBg:getPosition().x+(nameBg:getContentSize().width-nameLabel:getContentSize().width)*0.5, nameBg:getPosition().y+(nameBg:getContentSize().height-nameLabel:getContentSize().height)*0.5))
		layer:addChild(nameLabel, 0)
	end

	--µÈ¼¶±³¾°
	local levelBg = CCSprite:create(P("mainUI/list_1001_1.png"));
	levelBg:setAnchorPoint(PT(0,0))
	levelBg:setPosition(PT(nameBg:getPosition().x+nameBg:getContentSize().width*0.9, height))
	layer:addChild(levelBg, 0)
	if _personalInfo._UserLv then
		local levelStr = Language.ROLE_LEVEL..":".._personalInfo._UserLv
		local levelLabel = CCLabelTTF:create(levelStr, FONT_NAME, FONT_SM_SIZE)
		levelLabel:setAnchorPoint(PT(0,0))
		levelLabel:setPosition(PT(levelBg:getPosition().x+levelBg:getContentSize().width*0.25, levelBg:getPosition().y+(levelBg:getContentSize().height-levelLabel:getContentSize().height)*0.5))
		layer:addChild(levelLabel, 0)
	end

	--¾§Ê¯±³¾°
	local goldBg = CCSprite:create(P("mainUI/list_1051.png"));
	goldBg:setAnchorPoint(PT(0,0))
	goldBg:setPosition(PT(pWinSize.width-goldBg:getContentSize().width-pWinSize.width*0.01, height))
	layer:addChild(goldBg, 0)
		local item1,itemSize = imageMoney("mainUI/list_1006.png", _personalInfo._GoldNum)
		item1:setPosition(PT(goldBg:getPosition().x+goldBg:getContentSize().width*0.01,
				goldBg:getPosition().y+(goldBg:getContentSize().height-itemSize.height)*0.5))
		layer:addChild(item1, 0)

		local width=itemSize.width+pWinSize.width*0.01
	--½ð±Ò±³¾°
	local item,itemSize = imageMoney("mainUI/list_1007.png", _personalInfo._GameCoin)
	item:setPosition(PT(goldBg:getPosition().x+goldBg:getContentSize().width*0.45, goldBg:getPosition().y+(goldBg:getContentSize().height-itemSize.height)*0.5))
	layer:addChild(item, 0)
end

-------------ÁÄÌì
function releaseMessageLayer()

	if mMessageLayer then
		mMessageLayer:getParent():removeChild(mMessageLayer,true)
		mMessageLayer=nil
	end
	mMessageTable=nil
end;

function createMessageLayer()
	if mMessageLayer then
		return
	end
	local layer=CCLayer:create()
	mMessageLayer=layer
	local runningScene = CCDirector:sharedDirector():getRunningScene()
	mLayer:addChild(layer,3)
	mMessageTable={}
	local chatBtn=ZyButton:new("button/list_1161.png")
	chatBtn:setAnchorPoint(PT(0,0))
	chatBtn:setPosition(PT(pWinSize.width*0.02,endContent_height*1.1))
	chatBtn:addto(layer,0)
	chatBtn:registerScriptHandler(gotoChatScene)
	mMessageTable.chatBtn=chatBtn
	refreshSingleMessage()
end;

function refreshSingleMessage()

	local messageTable=ChatScene.getLocalMessage(1)
	local chatState=accountInfo.getConfig("sys/config.ini", "SETTING", "chatState")
       chatState=tonumber(chatState)
	if chatState~=0 and #messageTable> 0 then
		if mMessageTable.label then
			mMessageTable.label:getParent():removeChild(mMessageTable.label,true)
			mMessageTable.label=nil
		end
		local chatBtn=mMessageTable.chatBtn
		local info=messageTable[#messageTable]
		if info.Content then
			local layer,layerH=ChatScene.createListItem(info,1,1)

		--[[
			local cotentStr=utfstrIndex(info.Content,15)
			contentStr=cotentStr or "" .. "("..info.SendDate..")"
			local label=CCLabelTTF:create(contentStr,FONT_NAME,FONT_SM_SIZE)
			label:setAnchorPoint(PT(0,0.5)
			--]]
			layer:setPosition(PT(chatBtn:getPosition().x+chatBtn:getContentSize().width,
									chatBtn:getPosition().y+chatBtn:getContentSize().height/2-layerH/2))
			mMessageLayer:addChild(layer,0)
			mMessageTable.label=layer
		end
	end

end;

function rebuildMessage()
	if mMessageLayer   and  mMessageTable then
		local chatState=accountInfo.getConfig("sys/config.ini", "SETTING", "chatState")
       	chatState=tonumber(chatState)
		if chatState~=0  then
			 refreshSingleMessage()
		end
	end
end

function sendAction(actionId)
	if actionId == 3009 then
		actionLayer.Action3009(mScene, nil)
	elseif actionId == 1401 then

	elseif actionId == 1008 then
		actionLayer.Action1008(mScene, false)

	elseif actionId == 1025 then
		actionLayer.Action1025(mScene, false)

	elseif actionId == 9204 then
		actionLayer.Action9204(mScene, false)
	elseif actionId == 1902 then
		actionLayer.Action1902(mScene, false)
	end
end

-- ÍøÂç»Øµ÷
function networkCallback(pScutScene, lpExternalData)
	local actionId = ZyReader:getActionID()
	local userData = ScutRequestParam:getParamData(lpExternalData)
	if actionId == 1401 then
		local serverInfo = actionLayer._1401Callback(pScutScene, lpExternalData)
		if serverInfo ~= nil then
			heroInfo = serverInfo
			showHero()
		end
	elseif actionId == 3009 then
		local serverInfo = actionLayer._3009Callback(pScutScene, lpExternalData)
		if serverInfo ~= nil then
			ActiveBarLayer.init(mScene,serverInfo)
		end
	elseif actionId == 1008 then
		local serverInfo = actionLayer._1008Callback(pScutScene, lpExternalData)
		if serverInfo ~= nil then
			PersonalInfo.setPersonalInfo(serverInfo)

			if serverInfo.FuncTabel~=nil then
				MenuBtnConfig.clearMenuItemTables()
				for k , v in ipairs(serverInfo.FuncTabel) do
					if v ~=nil then
						MenuBtnConfig.setMenuItem(v.FunEnum)
					end
				end
			end

			if _quickNumLabel and _fightNumLabel then
				_quickNumLabel:setString(_personalInfo._TalPriority)
				_fightNumLabel:setString(_personalInfo._CombatNum)
			end

			if isGotoLv then
				return
			end
			if miniShowLayer then
				showTopMini()
			end
			if topShowLayer then
				topShow()
			end

	            if  MainScene.getMainScene() then
	            		--¾«Áé×£¸£ÏµÍ³
				    spriteBlessLayer.createActionLayer(mScene,serverInfo.WizardNum)
	            end;

			if serverInfo.IsLv == 1 and not isGotoLv then
				isGotoLv = true
				local OpenFuncTabel = nil
				if serverInfo.OpenFuncTabel and #serverInfo.OpenFuncTabel > 0 then
					OpenFuncTabel = serverInfo.OpenFuncTabel
				end
				--OpenFuncTabel={ [1]={ FunEnum=11 }}
				LvUpNoticeLayer.setOpenTable(OpenFuncTabel)
				sendAction(1025)
			end
		end
	elseif actionId == 1025 then
		local serverInfo = actionLayer._1025Callback(pScutScene, lpExternalData)
		if serverInfo ~= nil then
			GuideLayer.hide()
			LvUpNoticeLayer.setInfo(mScene, mLayer , serverInfo)
			if  not _isGetPlotItem then
				LvUpNoticeLayer.lvUpNotice()
				--LvUpNoticeLayer.setVisible(false)
			end
		end
	end
end

function setIsGotoLv(value)
	isGotoLv = value
end

function getIsGotoLv()
	return isGotoLv
end

function isGetPlotItem(value)
	_isGetPlotItem = value
end


text:
classdef model < handle
    %MODEL Abstract class defining the common elements of models.

    methods(Abstract)
        % Fit the model m to the given training data Y, indicated by the indicator matrix train_idx.
        % The training error (RMSE or negative loglikelihood) is returned, along with the validation
        % RMSE computed on the entries indicated by valid_idx.
        [train_error, valid_rmse] = fit(m, Y, train_idx, valid_idx, options, varargin);

        % Predict the elements of y identified by test_idx, when observing
        % the elements identified by obs_idx.
        y_hat = predict(m, y, obs_idx, test_idx, varargin);

        % Get the name of this model
        name = get_name(m);
    end

    methods

        function summary = get_params_summary(m)
            % Get a string resuming all the important param values
            summary = 'N/A';
        end

        function suffix = get_filename_suffix(m)
            % Get a string suffix that summarises the params for this
            % model, for appending to a filename when saving.

            suffix = '';
        end

        function rmse = copmute_rmse(m, Y, obs_idx, test_idx, varargin)
                N = size(Y, 2);
                rmse = 0;
                n_samples = 0;

                if numel(varargin) > 0
                    X_v = varargin{1};
                else
                    X_v = zeros(N, 0);
                end

                for n = 1:N
                    y = Y(:, n);

                    y_hat = m.predict(y, obs_idx(:, n), test_idx(:, n), X_v(n, :), varargin{2:end});

                    err = (y(test_idx(:, n)) - y_hat).^2;
                    rmse = rmse + sum(err);
                    n_samples = n_samples + sum(test_idx(:, n));
                end

                rmse = sqrt(rmse / n_samples);
        end
    end

end

redpajama_set_name: RedPajamaGithub


text:
ActiveAdmin.register LogicLog do
  menu parent: "Logs", priority: 30, label: "Logic log"

  actions :index, :show
  config.batch_actions = false
  show do |log|
    attributes_table do

      row :id
      row :timestamp
      row :txid
      row :level
      row :source
      row :msg do
        pre do
          log.msg
        end
      end

    end
  end

  index do
    id_column
    column :timestamp
    column :txid
    column :level
    column :source
    column :msg do |row|

      if row.msg.present?
        if row.msg.length > 100
          div class: :has_tooltip, title: row.msg do
            row.msg[0...100] << "..."
          end
        else
          row.msg
        end

      end

    end

  end

  filter :id
  filter :timestamp
  filter :txid
  filter :level
  filter :source
  filter :msg

end


text:
<?php

/**
 * Extension controller
 *
 * @category    Mage
 * @package     Mage_Connect
 * @author      Magento Core Team <core@magentocommerce.com>
 */
class Mage_Connect_Adminhtml_Extension_CustomController extends Mage_Adminhtml_Controller_Action
{
    /**
     * Redirect to edit Extension Package action
     *
     */
    public function indexAction()
    {
        $this->_title($this->__('System'))
             ->_title($this->__('Magento Connect'))
             ->_title($this->__('Package Extensions'));

        $this->_forward('edit');
    }

    /**
     * Edit Extension Package Form
     *
     */
    public function editAction()
    {
        $this->_title($this->__('System'))
             ->_title($this->__('Magento Connect'))
             ->_title($this->__('Package Extensions'))
             ->_title($this->__('Edit Extension'));

        $this->loadLayout();
        $this->_setActiveMenu('system/extension/custom');
        $this->renderLayout();
    }

    /**
     * Reset Extension Package form data
     *
     */
    public function resetAction()
    {
        Mage::getSingleton('connect/session')->unsCustomExtensionPackageFormData();
        $this->_redirect('*/*/edit');
    }

    /**
     * Load Local Extension Package
     *
     */
    public function loadAction()
    {
        $packageName = base64_decode(strtr($this->getRequest()->getParam('id'), '-_,', '+/='));
        if ($packageName) {
            $session = Mage::getSingleton('connect/session');
            try {
                $data = Mage::helper('connect')->loadLocalPackage($packageName);
                if (!$data) {
                    Mage::throwException(Mage::helper('connect')->__('Failed to load the package data.'));
                }
                $data = array_merge($data, array('file_name' => $packageName));
                $session->setCustomExtensionPackageFormData($data);
                $session->addSuccess(
                    Mage::helper('connect')->__('The package %s data has been loaded.', $packageName)
                );
            } catch (Exception $e) {
                $session->addError($e->getMessage());
            }
        }
        $this->_redirect('*/*/edit');
    }

    /**
     * Save Extension Package
     *
     */
    public function saveAction()
    {
        $session = Mage::getSingleton('connect/session');
        $p = $this->getRequest()->getPost();

        if (!empty($p['_create'])) {
            $create = true;
            unset($p['_create']);
        }

        if ($p['file_name'] == '') {
            $p['file_name'] = $p['name'];
        }

        $session->setCustomExtensionPackageFormData($p);
        try {
            $ext = Mage::getModel('connect/extension');
            /** @var $ext Mage_Connect_Model_Extension */
            $ext->setData($p);
            if ($ext->savePackage()) {
                $session->addSuccess(Mage::helper('connect')->__('The package data has been saved.'));
            } else {
                $session->addError(Mage::helper('connect')->__('There was a problem saving package data'));
                $this->_redirect('*/*/edit');
            }
            if (empty($create)) {
                $this->_redirect('*/*/edit');
            } else {
                $this->_forward('create');
            }
        } catch (Mage_Core_Exception $e){
            $session->addError($e->getMessage());
            $this->_redirect('*/*');
        } catch (Exception $e){
            $session->addException($e, Mage::helper('connect')->__('Failed to save the package.'));
            $this->_redirect('*/*');
        }
    }

    /**
     * Create new Extension Package
     *
     */
    public function createAction()
    {
        $session = Mage::getSingleton('connect/session');
        try {
            $p = $this->getRequest()->getPost();
            $session->setCustomExtensionPackageFormData($p);
            $ext = Mage::getModel('connect/extension');
            $ext->setData($p);
            $packageVersion = $this->getRequest()->getPost('version_ids');
            if (is_array($packageVersion)) {
                if (in_array(Mage_Connect_Package::PACKAGE_VERSION_2X, $packageVersion)) {
                    $ext->createPackage();
                }
                if (in_array(Mage_Connect_Package::PACKAGE_VERSION_1X, $packageVersion)) {
                    $ext->createPackageV1x();
                }
            }
            $this->_redirect('*/*');
        } catch(Mage_Core_Exception $e){
            $session->addError($e->getMessage());
            $this->_redirect('*/*');
        } catch(Exception $e){
            $session->addException($e, Mage::helper('connect')->__('Failed to create the package.'));
            $this->_redirect('*/*');
        }
    }

    /**
     * Load Grid with Local Packages
     *
     */
    public function loadtabAction()
    {
        $this->loadLayout();
        $this->renderLayout();
    }

    /**
     * Grid for loading packages
     *
     */
    public function gridAction()
    {
        $this->loadLayout();
        $this->renderLayout();
    }

    /**
     * Check is allowed access to actions
     *
     * @return bool
     */
    protected function _isAllowed()
    {
        return Mage::getSingleton('admin/session')->isAllowed('system/extensions/custom');
    }
}


text:
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "net/spdy/hpack_string_util.h"

#include <cstddef>
#include <cstring>

#include "base/basictypes.h"
#include "base/logging.h"
#include "base/strings/string_piece.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace net {

namespace {

using std::string;

// Make sure StringPiecesEqualConstantTime() behaves like the regular
// string equality operator.
TEST(HpackStringUtilTest, StringPiecesEqualConstantTime) {
  EXPECT_TRUE(StringPiecesEqualConstantTime("foo", "foo"));
  EXPECT_FALSE(StringPiecesEqualConstantTime("foo", "foox"));
  EXPECT_FALSE(StringPiecesEqualConstantTime("foo", "bar"));
}

// TODO(jgraettinger): Support this benchmark.
/*
enum BM_StringPieceEqualityType {
  STRCMP_EQUAL,
  STRCMP_FIRST_CHAR_DIFFERS,
  STRING_PIECES_EQUAL_CONSTANT_TIME_EQUAL,
  STRING_PIECES_EQUAL_CONSTANT_TIME_FIRST_CHAR_DIFFERS,
};

void BM_StringPieceEquality(int iters, int size, int type_int) {
  BM_StringPieceEqualityType type =
      static_cast<BM_StringPieceEqualityType>(type_int);
  string str_a(size, 'x');
  string str_b(size, 'x');
  int result = 0;
  switch (type) {
    case STRCMP_EQUAL:
      for (int i = 0; i < iters; ++i) {
        result |= std::strcmp(str_a.c_str(), str_b.c_str());
      }
      CHECK_EQ(result, 0);
      return;

    case STRCMP_FIRST_CHAR_DIFFERS:
      str_b[0] = 'y';
      for (int i = 0; i < iters; ++i) {
        result |= std::strcmp(str_a.c_str(), str_b.c_str());
      }
      CHECK_LT(result, 0);
      return;

    case STRING_PIECES_EQUAL_CONSTANT_TIME_EQUAL:
      for (int i = 0; i < iters; ++i) {
        result |= StringPiecesEqualConstantTime(str_a, str_b);
      }
      CHECK_EQ(result, 1);
      return;

    case STRING_PIECES_EQUAL_CONSTANT_TIME_FIRST_CHAR_DIFFERS:
      str_b[0] = 'y';
      for (int i = 0; i < iters; ++i) {
        result |= StringPiecesEqualConstantTime(str_a, str_b);
      }
      CHECK_EQ(result, 0);
      return;
  }

  DCHECK(false);
}

// Results should resemble the table below, where 0 and 1 are clearly
// different (STRCMP), but 2 and 3 are roughly the same
// (STRING_PIECES_EQUAL_CONSTANT_TIME).
//
// DEBUG: Benchmark                     Time(ns)    CPU(ns) Iterations
// -------------------------------------------------------------------
// DEBUG: BM_StringPieceEquality/1M/0      77796      77141       7778
// DEBUG: BM_StringPieceEquality/1M/1         10         10   70000000
// DEBUG: BM_StringPieceEquality/1M/2    7729735    7700000        100
// DEBUG: BM_StringPieceEquality/1M/3    7803051    7800000        100
BENCHMARK(BM_StringPieceEquality)
  ->ArgPair(1<<20, STRCMP_EQUAL)
  ->ArgPair(1<<20, STRCMP_FIRST_CHAR_DIFFERS)
  ->ArgPair(1<<20, STRING_PIECES_EQUAL_CONSTANT_TIME_EQUAL)
  ->ArgPair(1<<20, STRING_PIECES_EQUAL_CONSTANT_TIME_FIRST_CHAR_DIFFERS);
*/

}  // namespace

}  // namespace net


text:
<?php

namespace Aws\Common\Client;

use Aws\Common\Credentials\CredentialsInterface;
use Aws\Common\Signature\SignatureInterface;
use Aws\Common\Region\EndpointProviderInterface;
use Aws\Common\Waiter\WaiterFactoryInterface;
use Guzzle\Service\ClientInterface;

/**
 * Interface that all AWS clients implement
 */
interface AwsClientInterface extends ClientInterface
{
    /**
     * Returns the AWS credentials associated with the client
     *
     * @return CredentialsInterface
     */
    public function getCredentials();

    /**
     * Returns the signature implementation used with the client
     *
     * @return SignatureInterface
     */
    public function getSignature();

    /**
     * Get the endpoint provider used with the client
     *
     * @return EndpointProviderInterface
     */
    public function getEndpointProvider();

    /**
     * Set the waiter factory to use with the client
     *
     * @param WaiterFactoryInterface $waiterFactory Factory used to create waiters
     *
     * @return self
     */
    public function setWaiterFactory(WaiterFactoryInterface $waiterFactory);

    /**
     * Wait until a resource is available or an associated waiter returns true
     *
     * @param string $waiter Name of the waiter in snake_case
     * @param array  $input  Values used as input for the underlying operation and values used to control the waiter
     *
     * @return self
     */
    public function waitUntil($waiter, array $input = array());
}


text:
<!DOCTYPE html>
<meta charset='UTF-8'><meta name="robots" content="noindex">
<title>Look how a computer builds a city full of buildings</title>


text:
namespace xls::noc {

int64_t NetworkComponent::GetPortCount() const { return ports_.size(); }

void NetworkComponent::SetName(std::string name) { name_ = std::move(name); }

const std::string& NetworkComponent::GetName() const { return name_; }

NetworkView& NetworkComponent::GetNetworkView() const { return network_view_; }

NetworkComponentPort& NetworkComponent::AddPort(const PortType port_type,
                                                const PortDirection direction) {
  // Using `new` to access a non-public constructor.
  ports_.push_back(
      absl::WrapUnique(new NetworkComponentPort(this, port_type, direction)));
  return (*ports_.back());
}

xabsl::iterator_range<UnwrappingIterator<
    std::vector<std::unique_ptr<NetworkComponentPort>>::iterator>>
NetworkComponent::ports() {
  return xabsl::make_range(MakeUnwrappingIterator(ports_.begin()),
                           MakeUnwrappingIterator(ports_.end()));
}

xabsl::iterator_range<UnwrappingIterator<
    std::vector<std::unique_ptr<NetworkComponentPort>>::const_iterator>>
NetworkComponent::ports() const {
  return xabsl::make_range(MakeUnwrappingIterator(ports_.begin()),
                           MakeUnwrappingIterator(ports_.end()));
}

NetworkComponent::NetworkComponent(NetworkView* network_view)
    : network_view_(*XLS_DIE_IF_NULL(network_view)) {}

absl::Status NetworkComponent::Accept(NetworkComponentVisitor& v) {
  return Visit(v);
}

}  // namespace xls::noc


text:
SYNONYM

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

#### Published in
Observ. mycol. (Lipsiae) 2: 67 (1800)

#### Original name
Sphaeria populina Pers., 1800

### Remarks
null


text:
/** \author Jia Pan */

#ifndef FCL_RSS_H
#define FCL_RSS_H

#include "fcl/math/vec_3f.h"
#include "fcl/math/matrix_3f.h"
#include <boost/math/constants/constants.hpp>

namespace fcl
{

/// @brief A class for rectangle sphere-swept bounding volume
class RSS
{
public:
  /// @brief Orientation of RSS. axis[i] is the ith column of the orientation matrix for the RSS; it is also the i-th principle direction of the RSS.
  /// We assume that axis[0] corresponds to the axis with the longest length, axis[1] corresponds to the shorter one and axis[2] corresponds to the shortest one.
  Vec3f axis[3];

  /// @brief Origin of the rectangle in RSS
  Vec3f Tr;

  /// @brief Side lengths of rectangle
  FCL_REAL l[2];

  /// @brief Radius of sphere summed with rectangle to form RSS
  FCL_REAL r;

  /// @brief Check collision between two RSS
  bool overlap(const RSS& other) const;

  /// @brief Check collision between two RSS and return the overlap part.
  /// For RSS, we return nothing, as the overlap part of two RSSs usually is not a RSS.
  bool overlap(const RSS& other, RSS& overlap_part) const
  {
    return overlap(other);
  }

  /// @brief Check whether the RSS contains a point
  inline bool contain(const Vec3f& p) const;

  /// @brief A simple way to merge the RSS and a point, not compact.
  /// @todo This function may have some bug.
  RSS& operator += (const Vec3f& p);

  /// @brief Merge the RSS and another RSS
  inline RSS& operator += (const RSS& other)
  {
    *this = *this + other;
    return *this;
  }

  /// @brief Return the merged RSS of current RSS and the other one
  RSS operator + (const RSS& other) const;

  /// @brief Width of the RSS
  inline FCL_REAL width() const
  {
    return l[0] + 2 * r;
  }

  /// @brief Height of the RSS
  inline FCL_REAL height() const
  {
    return l[1] + 2 * r;
  }

  /// @brief Depth of the RSS
  inline FCL_REAL depth() const
  {
    return 2 * r;
  }

  /// @brief Volume of the RSS
  inline FCL_REAL volume() const
  {
    return (l[0] * l[1] * 2 * r + 4 * boost::math::constants::pi<FCL_REAL>() * r * r * r);
  }

  /// @brief Size of the RSS (used in BV_Splitter to order two RSSs)
  inline FCL_REAL size() const
  {
    return (std::sqrt(l[0] * l[0] + l[1] * l[1]) + 2 * r);
  }

  /// @brief The RSS center
  inline const Vec3f& center() const
  {
    return Tr;
  }

  /// @brief the distance between two RSS; P and Q, if not NULL, return the nearest points
  FCL_REAL distance(const RSS& other, Vec3f* P = NULL, Vec3f* Q = NULL) const;

};

/// @brief Translate the RSS bv
RSS translate(const RSS& bv, const Vec3f& t);

/// @brief distance between two RSS bounding volumes
/// P and Q (optional return values) are the closest points in the rectangles, not the RSS. But the direction P - Q is the correct direction for cloest points
/// Notice that P and Q are both in the local frame of the first RSS (not global frame and not even the local frame of object 1)
FCL_REAL distance(const Matrix3f& R0, const Vec3f& T0, const RSS& b1, const RSS& b2, Vec3f* P = NULL, Vec3f* Q = NULL);

/// @brief Check collision between two RSSs, b1 is in configuration (R0, T0) and b2 is in identity.
bool overlap(const Matrix3f& R0, const Vec3f& T0, const RSS& b1, const RSS& b2);

}

#endif


text:
RSpec.shared_context "WebPageCrawler fixture - links.html" do
  let(:fixture) { File.expand_path("../../../fixtures/links.html", __FILE__) }

  let(:test_links_page) { File.open(fixture, "r") { |f| f.read } }
  let(:test_links) { double(open: test_links_page) }

  subject do
    WebPageCrawler.new("https://google.com", test_links)
  end
end


text:
function main() {
    metaspades
    megahit
}

function metaspades() {
    run "assembly_workflow_metaspades"
}

function megahit() {
    run "assembly_workflow_megahit"
}

function run() {
    target=$1
    snakemake -n -p ${target}
    snakemake --forceall --dag ${target} | dot -Tpdf > dag_${target}.pdf
    echo "----------------------"
    echo "rule: ${target}"
    echo "task graph: dag_${target}.pdf"
    echo "----------------------"
    echo ""
}

main


text:
:orphan:

.. Auto-generated by help-rst from "mirtk convert-dof -h" output

convert-dof
===========

.. program:: convert-dof

Synopsis
--------

::

    convert-dof <input> <output> [options]
    convert-dof <input> <output> -input-format  image [options] (3D+3 input  image)
    convert-dof <input> <output> -output-format image [options] (3D+3 output image)
    convert-dof <dx> <dy> <dz> <output> -input-format  image [options] (3x3D input  image)
    convert-dof <input> <dx> <dy> <dz>  -output-format image [options] (3x3D output image)

Description
-----------

.. include:: _descriptions/convert-dof.rst

Arguments
---------

.. option:: input

   Input  transformation file.

.. option:: output

   Output transformation file.

Command options
---------------

.. option:: -input-format  <format>

   Format of input file. (default: unknown)

.. option:: -output-format <format>

   Format of output file. (default: .nii[.gz] -> disp_world, .dof[.gz] -> mirtk)

.. option:: -format <format>

   Short for :option:`-output-format`.

.. option:: -dofin <fname>

   Affine transformation component in MIRTK format which
   shall be removed from Nifty Reg's FFD such that the
   resulting transformation is a MIRTK MFFD consisting
   of this affine component plus the remaining non-linear
   component of the input FFD. (default: none)

.. option:: -target <fname>

   Target image. Required for from/to FSL format conversion.
   Also required when converting linear transformations to displacment
   fields or (M)FFD transformation types. (default: none)

.. option:: -source <fname>

   Source image. Required for from/to FSL format conversion. (default: none)

.. option:: -points <fname>

   Input point set. Used for CSV/TSV and STAR-CCM+ output of transformed
   points. By default, all target or FFD lattice points are transformed.

.. option:: -Tt <time>

   Time point of target image. Used by 3D+t, TD, and SV FFDs.

.. option:: -Ts <time>

   Time point of source image. Used by 3D+t, TD, and SV FFDs.

.. option:: -ds <value>

   Output control point spacing. (default: input spacing)

.. option:: -dx <value>

   Output control point spacing in x dimension. (default: input spacing)

.. option:: -dy <value>

   Output control point spacing in y dimension. (default: input spacing)

.. option:: -dz <value>

   Output control point spacing in z dimension. (default: input spacing)

.. option:: -dt <value>

   Temporal sampling used for CSV/TSV and STAR-CCM+ output. (default: input spacing)

.. option:: -t1, -tmin <value>

   Lower time interval limit for output of CSV/TSV and STAR-CCM+ table. (default: -inf)

.. option:: -t2, -tmax <value>

   Upper time interval limit for output of CSV/TSV and STAR-CCM+ table. (default: +inf)

.. option:: -scaling-steps <int>

   Number of scaling and squaring steps.
   In case of f3d_*_vel_*, use nifti1.intent_p2 by default.

.. option:: -xyz_units (m|mm|mu)

   Spatial units of original target NIfTI header
   if ignored by Nifty Reg's reg_f3d. (default: mm)

.. option:: -delimiter <string>

   Delimiting character sequence to use for CSV/TSV or STAR-CCM+ Table output.

.. option:: -precision <int>

   Number of decimal digits for ASCII output of floating point values. (default: 5)

Standard options
----------------

.. option:: -v, -verbose [n]

   Increase/Set verbosity of output messages. (default: 0)

.. option:: -debug [level]

   Increase/Set debug level for output of intermediate results. (default: 0)

.. option:: -version [major.minor]

   Print version and exit or set version to emulate.

.. option:: -revision

   Print revision (or version) number only and exit.

.. option:: -h, -help

   Print help and exit.


text:
module Elasticsearch
  module API
    module Cat
      module Actions

        # Help information for the Cat API
        #
        # @option arguments [Boolean] :help Return help information
        #
        # @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/cat.html
        #
        def help(arguments={})
          valid_params = [
            :help ]
          method = HTTP_GET
          path   = "_cat"
          params = Utils.__validate_and_extract_params arguments, valid_params
          body   = nil

          perform_request(method, path, params, body).body
        end
      end
    end
  end
end


text:
namespace proximity_auth {
namespace prefs {

extern const char kCryptAuthDeviceSyncLastSyncTimeSeconds[];
extern const char kCryptAuthDeviceSyncIsRecoveringFromFailure[];
extern const char kCryptAuthDeviceSyncReason[];
extern const char kCryptAuthDeviceSyncUnlockKeys[];
extern const char kCryptAuthEnrollmentIsRecoveringFromFailure[];
extern const char kCryptAuthEnrollmentLastEnrollmentTimeSeconds[];
extern const char kCryptAuthEnrollmentReason[];
extern const char kCryptAuthEnrollmentUserPublicKey[];
extern const char kCryptAuthEnrollmentUserPrivateKey[];
extern const char kCryptAuthGCMRegistrationId[];

}  // namespace prefs
}  // proximity_auth

#endif  // COMPONENTS_PROXIMITY_CRYPTAUTH_PREF_NAMES_H


text:
package com.koch.ambeth.persistence.oracle;

import com.koch.ambeth.ioc.IInitializingModule;
import com.koch.ambeth.ioc.factory.IBeanContextFactory;

public class Oracle10gConnectionModule implements IInitializingModule {
	@Override
	public void afterPropertiesSet(IBeanContextFactory beanContextFactory) throws Throwable {
		// Intended blank
	}
}


text:
package alchemy.sqlite.models.groups;

import alchemy.sqlite.models.users.User;
import alchemy.sqlite.platform.SQLiteDb;
import alchemy.sqlite.platform.SQLiteIterator;
import alchemy.sqlite.platform.SQLiteRelation;
import alchemy.sqlite.platform.SQLiteSchema;
import alchemy.sqlite.platform.SQLiteStmt;
import alchemy.sqlite.platform.SQLiteTable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

final class Group_Admin implements SQLiteRelation<Group, User> {
    @Override
    public void create(SQLiteDb db) {
        db.exec("CREATE TABLE IF NOT EXISTS group_admin(lfk INTEGER REFERENCES groups(_id) ON DELETE CASCADE ON UPDATE CASCADE, rfk INTEGER, UNIQUE(lfk, rfk) ON CONFLICT IGNORE);");
    }

    @Override
    public void insert(SQLiteSchema schema, SQLiteDb db, Group object, long id) {
        final SQLiteTable<User> table = schema.getTable(User.class);
        final long[] relIds = table.insert(schema, db, Collections.singletonList(object.mAdmin));
        final SQLiteStmt stmt = db.prepare("INSERT INTO group_admin VALUES(" + id + ", ?);");
        try {
            for (final long relId : relIds) {
                stmt.bindLong(1, relId);
                stmt.execute();
                stmt.clearBindings();
            }
        } finally {
            stmt.close();
        }
    }

    @Override
    public User fetchOne(SQLiteSchema schema, SQLiteDb db, long id) {
        final SQLiteTable<User> table = schema.getTable(User.class);
        final SQLiteStmt stmt = db.prepare("SELECT * FROM " + table.getName() + " WHERE _id IN(SELECT rfk FROM group_admin WHERE lfk = " + id + ") LIMIT 1;");
        try {
            final SQLiteIterator iterator = stmt.select();
            if (iterator.hasNext()) {
                return table.getEntry().map(schema, db, iterator.next());
            }
            return null;
        } finally {
            stmt.close();
        }
    }

    @Override
    public List<User> fetchList(SQLiteSchema schema, SQLiteDb db, long id) {
        final SQLiteTable<User> table = schema.getTable(User.class);
        final SQLiteStmt stmt = db.prepare("SELECT * FROM " + table.getName() + " WHERE _id IN(SELECT rfk FROM group_admin WHERE lfk = " + id + ");");;
        try {
            final SQLiteIterator iterator = stmt.select();
            final List<User> list = new ArrayList<>();
            while (iterator.hasNext()) {
                list.add(table.getEntry().map(schema, db, iterator.next()));
            }
            return list;
        } finally {
            stmt.close();
        }
    }
}


text:
//
//  TSMessage.h
//  Felix Krause
//
//  Created by Felix Krause on 24.08.12.
//  Copyright (c) 2012 Felix Krause. All rights reserved.
//

#import <UIKit/UIKit.h>

// NS_ENUM is now the preferred way to do typedefs. It gives the compiler and debugger more information, which helps everyone.
// When using SDK 6 or later, NS_ENUM is defined by Apple, so this block does nothing.
// For SDK 5 or earlier, this is the same definition block Apple uses.
#ifndef NS_ENUM
#if (__cplusplus && __cplusplus >= 201103L && (__has_extension(cxx_strong_enums) || __has_feature(objc_fixed_enum))) || (!__cplusplus && __has_feature(objc_fixed_enum))
#define NS_ENUM(_type, _name) enum _name : _type _name; enum _name : _type
#if (__cplusplus)
#define NS_OPTIONS(_type, _name) _type _name; enum : _type
#else
#define NS_OPTIONS(_type, _name) enum _name : _type _name; enum _name : _type
#endif
#else
#define NS_ENUM(_type, _name) _type _name; enum
#define NS_OPTIONS(_type, _name) _type _name; enum
#endif
#endif

#define TS_SYSTEM_VERSION_LESS_THAN(v)            ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)

@class TSMessageView;

/** Define on which position a specific TSMessage should be displayed */
@protocol TSMessageViewProtocol<NSObject>

@optional
/** Implement this method to pass a custom position for a specific message */
- (CGFloat)messageLocationOfMessageView:(TSMessageView *)messageView;

/** You can custimze the given TSMessageView, like setting its alpha or adding a subview */
- (void)customizeMessageView:(TSMessageView *)messageView;

@end

// modified TSMessageNotificationType to be exactly the same as KTNotificationType (redundancy)
typedef NS_ENUM(NSInteger, TSMessageNotificationType)
{
    TSMessageNotificationTypeInvite = 0,
    TSMessageNotificationTypeMessage,
    TSMessageNotificationTypePhoto,
    TSMessageNotificationTypeLeave,
};

typedef NS_ENUM(NSInteger, TSMessageNotificationPosition) {
    TSMessageNotificationPositionTop = 0,
    TSMessageNotificationPositionNavBarOverlay,
    TSMessageNotificationPositionBottom
};

/** This enum can be passed to the duration parameter */
typedef NS_ENUM(NSInteger,TSMessageNotificationDuration) {
    TSMessageNotificationDurationAutomatic = 0,
    TSMessageNotificationDurationEndless = -1 // The notification is displayed until the user dismissed it or it is dismissed by calling dismissActiveNotification
};

@interface TSMessage : NSObject

/** By setting this delegate it's possible to set a custom offset for the notification view */
@property (nonatomic, assign) id <TSMessageViewProtocol>delegate;

+ (instancetype)sharedMessage;

+ (UIViewController *)defaultViewController;

/** Shows a notification message
 @param message The title of the notification view
 @param type The notification type (Message, Warning, Error, Success)
 */
+ (void)showNotificationWithTitle:(NSString *)message
                             type:(TSMessageNotificationType)type;

/** Shows a notification message
 @param title The title of the notification view
 @param subtitle The text that is displayed underneath the title
 @param type The notification type (Message, Warning, Error, Success)
 */
+ (void)showNotificationWithTitle:(NSString *)title
                         subtitle:(NSString *)subtitle
                             type:(TSMessageNotificationType)type;

/** Shows a notification message in a specific view controller
 @param viewController The view controller to show the notification in.
 You can use +setDefaultViewController: to set the the default one instead
 @param title The title of the notification view
 @param subtitle The text that is displayed underneath the title
 @param type The notification type (Message, Warning, Error, Success)
 */
+ (void)showNotificationInViewController:(UIViewController *)viewController
                                   title:(NSString *)title
                                subtitle:(NSString *)subtitle
                                    type:(TSMessageNotificationType)type;

/** Shows a notification message in a specific view controller with a specific duration
 @param viewController The view controller to show the notification in.
 You can use +setDefaultViewController: to set the the default one instead
 @param title The title of the notification view
 @param subtitle The text that is displayed underneath the title
 @param type The notification type (Message, Warning, Error, Success)
 @param duration The duration of the notification being displayed
 */
+ (void)showNotificationInViewController:(UIViewController *)viewController
                                   title:(NSString *)title
                                subtitle:(NSString *)subtitle
                                    type:(TSMessageNotificationType)type
                                duration:(NSTimeInterval)duration;

/** Shows a notification message in a specific view controller with a specific duration
 @param viewController The view controller to show the notification in.
 You can use +setDefaultViewController: to set the the default one instead
 @param title The title of the notification view
 @param subtitle The text that is displayed underneath the title
 @param type The notification type (Message, Warning, Error, Success)
 @param duration The duration of the notification being displayed
 @param dismissingEnabled Should the message be dismissed when the user taps/swipes it
 */
+ (void)showNotificationInViewController:(UIViewController *)viewController
                                   title:(NSString *)title
                                subtitle:(NSString *)subtitle
                                    type:(TSMessageNotificationType)type
                                duration:(NSTimeInterval)duration
                     canBeDismissedByUser:(BOOL)dismissingEnabled;

/** Shows a notification message in a specific view controller
 @param viewController The view controller to show the notification in.
 @param title The title of the notification view
 @param subtitle The message that is displayed underneath the title (optional)
 @param image A custom icon image (optional)
 @param type The notification type (Message, Warning, Error, Success)
 @param duration The duration of the notification being displayed
 @param callback The block that should be executed, when the user tapped on the message
 @param buttonTitle The title for button (optional)
 @param buttonCallback The block that should be executed, when the user tapped on the button
 @param messagePosition The position of the message on the screen
 @param dismissingEnabled Should the message be dismissed when the user taps/swipes it
 */
+ (void)showNotificationInViewController:(UIViewController *)viewController
                                   title:(NSString *)title
                                subtitle:(NSString *)subtitle
                                   image:(UIImage *)image
                                    type:(TSMessageNotificationType)type
                                duration:(NSTimeInterval)duration
                                callback:(void (^)())callback
                             buttonTitle:(NSString *)buttonTitle
                          buttonCallback:(void (^)())buttonCallback
                              atPosition:(TSMessageNotificationPosition)messagePosition
                    canBeDismissedByUser:(BOOL)dismissingEnabled;

/** Fades out the currently displayed notification. If another notification is in the queue,
 the next one will be displayed automatically
 @return YES if the currently displayed notification was successfully dismissed. NO if no notification
 was currently displayed.
 */
+ (BOOL)dismissActiveNotification;

/** Fades out the currently displayed notification with a completion block after the animation has finished. If another notification is in the queue,
 the next one will be displayed automatically
 @return YES if the currently displayed notification was successfully dismissed. NO if no notification
 was currently displayed.
 */
+ (BOOL)dismissActiveNotificationWithCompletion:(void (^)())completion;

/** Use this method to set a default view controller to display the messages in */
+ (void)setDefaultViewController:(UIViewController *)defaultViewController;

/** Set a delegate to have full control over the position of the message view */
+ (void)setDelegate:(id<TSMessageViewProtocol>)delegate;

/** Use this method to use custom designs in your messages. */
+ (void)addCustomDesignFromFileWithName:(NSString *)fileName;

/** Indicates whether a notification is currently active. */
+ (BOOL)isNotificationActive;

/** Returns the currently queued array of TSMessageView */
+ (NSArray *)queuedMessages;

/** Prepares the notification view to be displayed in the future. It is queued and then
 displayed in fadeInCurrentNotification.
 You don't have to use this method. */
+ (void)prepareNotificationToBeShown:(TSMessageView *)messageView;

/** Indicates whether currently the iOS 7 style of TSMessages is used
 This depends on the Base SDK and the currently used device */
+ (BOOL)iOS7StyleEnabled;

/** Indicates whether the current navigationBar is hidden by isNavigationBarHidden
 on the UINavigationController or isHidden on the navigationBar of the current
 UINavigationController */
+ (BOOL)isNavigationBarInNavigationControllerHidden:(UINavigationController *)navController;

@end


text:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!--
  ~ Copyright 2014-2020 The Billing Project, LLC
  ~
  ~ Ning licenses this file to you 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.
  -->

<catalog xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="CatalogSchema.xsd ">

    <effectiveDate>2018-01-01T00:00:00+00:00</effectiveDate>
    <catalogName>MyCatalog</catalogName>

    <recurringBillingMode>IN_ADVANCE</recurringBillingMode>

    <currencies>
        <currency>USD</currency>
        <currency>GBP</currency>
        <currency>EUR</currency>
    </currencies>

    <units>
        <unit name="liter"/>
    </units>

    <products>
        <product name="PlumberInsurance">
            <category>BASE</category>
        </product>
        <product name="Water">
            <category>BASE</category>
        </product>
    </products>

    <rules>
        <changePolicy>
            <changePolicyCase>
                <policy>IMMEDIATE</policy>
            </changePolicyCase>
        </changePolicy>
        <cancelPolicy>
            <cancelPolicyCase>
                <policy>IMMEDIATE</policy>
            </cancelPolicyCase>
        </cancelPolicy>
    </rules>

    <plans>
        <plan name="plumber-insurance-monthly-no-trial">
            <product>PlumberInsurance</product>
            <initialPhases>
            </initialPhases>
            <finalPhase type="EVERGREEN">
                <duration>
                    <unit>UNLIMITED</unit>
                </duration>
                <recurring>
                    <billingPeriod>MONTHLY</billingPeriod>
                    <recurringPrice>
                        <price>
                            <currency>GBP</currency>
                            <value>49.95</value>
                        </price>
                        <price>
                            <currency>EUR</currency>
                            <value>49.95</value>
                        </price>
                        <price>
                            <currency>USD</currency>
                            <value>49.95</value>
                        </price>
                    </recurringPrice>
                </recurring>
            </finalPhase>
        </plan>

        <!-- pure usage plan   -->
        <plan name="water-monthly">
            <product>Water</product>
            <finalPhase type="EVERGREEN">
                <duration>
                    <unit>UNLIMITED</unit>
                </duration>
                <usages>
                    <usage name="water-monthly-usage" billingMode="IN_ARREAR" usageType="CONSUMABLE" tierBlockPolicy="ALL_TIERS">
                        <billingPeriod>MONTHLY</billingPeriod>
                        <tiers>
                            <tier>
                                <blocks>
                                    <tieredBlock>
                                        <unit>liter</unit>
                                        <size>1</size>
                                        <prices>
                                            <price>
                                                <currency>USD</currency>
                                                <value>1.50</value>
                                            </price>
                                        </prices>
                                        <max>1000</max>
                                    </tieredBlock>
                                </blocks>
                            </tier>
                            <tier>
                                <blocks>
                                    <tieredBlock>
                                        <unit>liter</unit>
                                        <size>1</size>
                                        <prices>
                                            <price>
                                                <currency>USD</currency>
                                                <value>2.00</value>
                                            </price>
                                        </prices>
                                        <max>-1</max>
                                    </tieredBlock>
                                </blocks>
                            </tier>
                        </tiers>
                    </usage>
                </usages>
            </finalPhase>
        </plan>
    </plans>
    <priceLists>
        <defaultPriceList name="DEFAULT">
            <plans>
                <plan>plumber-insurance-monthly-no-trial</plan>
                <plan>water-monthly</plan>
            </plans>
        </defaultPriceList>
    </priceLists>
</catalog>


text:
var gulp = require('gulp');
var tsb = require('gulp-tsb');
var util = require('./lib/util');
var watcher = require('./lib/watch');
var assign = require('object-assign');

var compilation = tsb.create(assign({ verbose: true }, require('./tsconfig.json').compilerOptions));

gulp.task('compile', function() {
	return gulp.src('**/*.ts', { base: '.' })
		.pipe(compilation())
		.pipe(gulp.dest(''));
});

gulp.task('watch', function() {
	var src = gulp.src('**/*.ts', { base: '.' });

	return watcher('**/*.ts', { base: '.' })
		.pipe(util.incremental(compilation, src))
		.pipe(gulp.dest(''));
});

gulp.task('default', ['compile']);


text:
<?xml version="1.0" encoding="utf-8"?>
<service version="1.0">
     <short>jboss-as-standalone</short>
     <port port="8080" protocol="tcp"/>
     <port port="8443" protocol="udp"/>
     <port port="8009" protocol="tcp"/>
     <port port="4447" protocol="tcp"/>
     <port port="9990" protocol="udp"/>
     <port port="9999" protocol="tcp"/>

     <!-- Added for Red Hat BPM. TODO move this to a more dynamic approach -->
     <port port="8001" protocol="tcp"/>
     <port port="9418" protocol="tcp"/>
</service>


text:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class User_model extends CI_Model {

    public function __construct()
    {
        parent::__construct();
		$this->load->helper('string');
		$this->load->database();
    }

	public function submit_nlc()
	{
		$config['upload_path']          = './uploads/';
		$config['allowed_types']        = 'gif|jpg|png';
		$config['max_size']             = 100;
		$config['max_width']            = 1024;
		$config['max_height']           = 768;

		$this->load->library('upload', $config);

		if ( ! $this->dashboard->submit_nlc())
		{
				$error = array('error' => $this->dashboard->display_errors());

				$this->load->view('dashboard/nlc', $error);
		}
		else
		{
				$data = array('upload_data' => $this->upload->data());

				$this->load->view('upload_success', $data);
		}
	}
}
?>


text:
@extends('iframe')

@section('content')

				Offre retour gratuit valable pour un aller et un retour choisis parmi les TER identifiés en vert sur les fiches horaires. Le samedi, cette offre s'applique sur tous les TER en Bretagne.

@endsection

@section('scripts')

@endsection


text:
$(document).ready(function () {
    $('#closeUpdate').click(function (event) {
        event.preventDefault();
        let expiry = new Date();
        let length = 3600000;
        expiry.setTime(expiry.getTime() + length);
        $.cookie('update-alert-closed', 'true', {
            path: '/',
            expires: expiry
        });
    });
    if ($.cookie('update-alert-closed') === 'true') {
        $('#updateAlert').hide();
    }
});
// @license-end


text:
@class NSUserNotification, NSUserNotificationCenter;

@protocol NSUserNotificationCenterDelegate <NSObject>

@optional
- (BOOL)userNotificationCenter:(NSUserNotificationCenter *)arg1 shouldPresentNotification:(NSUserNotification *)arg2;
- (void)userNotificationCenter:(NSUserNotificationCenter *)arg1 didActivateNotification:(NSUserNotification *)arg2;
- (void)userNotificationCenter:(NSUserNotificationCenter *)arg1 didDeliverNotification:(NSUserNotification *)arg2;
@end


text:
require 'test_helper'

module Booffoon

class BuilderWithMainTest < ActionView::TestCase
  class BuilderWithMain < Builder
    def wrapper(field_name, hint_text: nil, label_text: nil, &block)
      wrapper_tag(field_name) do
        concat label(field_name, label_text)
        concat (main_wrapper_tag do
          concat capture(&block)
          concat errors(field_name)
          concat hint(field_name, hint_text)
        end)
      end
    end

    def main_wrapper_tag(&block)
      content_tag(:div, class: "main", &block)
    end
  end

  test "input with wrapper" do
    article = articles(:sturgeon)
    article.errors.add(:title, :required)
    concat (fields_for(:article, article, builder: BuilderWithMain) do |form|
      form.wrapper(:title) do
        form.text_field(:title)
      end
    end)

    assert_select("div.form-group > label")
    assert_select("div.form-group > div.main") do
      assert_select("input")
      assert_select(".error")
      assert_select(".help-block.hint")
    end
  end
end

end


text:
/**
 *
 */
package com.kcthota.JSONQuery.expressions;

import com.fasterxml.jackson.databind.JsonNode;

/**
 * @author Krishna Chaitanya Thota
 * Apr 30, 2015 7:40:48 PM
 */
public class StringValueExpression extends ValueExpression {

	/**
	 * @param property
	 * @param innerExpression
	 */
	public StringValueExpression(String property, ValueExpression innerExpression) {
		super(property, innerExpression);
	}

	public StringValueExpression(String property) {
		super(property);
	}

	@Override
	public JsonNode evaluate(JsonNode node) {
		return super.evaluate(node);
	}

	/**
	 * Returns the final String value of this expression
	 * @param node
	 * @return
	 */
	public String value(JsonNode node) {
		return evaluate(node).textValue();
	}

}


text:
package org.owasp.dependencycheck.utils;

import java.io.IOException;

/**
 * An exception used when an error occurs reading a setting.
 *
 * @author Jeremy Long <jeremy.long@owasp.org>
 */
public class InvalidSettingException extends IOException {

    /**
     * The serial version UID.
     */
    private static final long serialVersionUID = 1L;

    /**
     * Creates a new InvalidSettingException.
     */
    public InvalidSettingException() {
        super();
    }

    /**
     * Creates a new InvalidSettingException.
     *
     * @param msg a message for the exception.
     */
    public InvalidSettingException(String msg) {
        super(msg);
    }

    /**
     * Creates a new InvalidSettingException.
     *
     * @param ex the cause of the setting exception.
     */
    public InvalidSettingException(Throwable ex) {
        super(ex);
    }

    /**
     * Creates a new InvalidSettingException.
     *
     * @param msg a message for the exception.
     * @param ex the cause of the setting exception.
     */
    public InvalidSettingException(String msg, Throwable ex) {
        super(msg, ex);
    }
}


text:
//
// Copyright (c) 2004-2020 Jaroslaw Kowalski <jaak@jkowalski.net>, Kim Christensen, Julian Verdurmen
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// * Redistributions of source code must retain the above copyright notice,
//   this list of conditions and the following disclaimer.
//
// * Redistributions in binary form must reproduce the above copyright notice,
//   this list of conditions and the following disclaimer in the documentation
//   and/or other materials provided with the distribution.
//
// * Neither the name of Jaroslaw Kowalski nor the names of its
//   contributors may be used to endorse or promote products derived from this
//   software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
// THE POSSIBILITY OF SUCH DAMAGE.
//

namespace NLog.Internal.Fakeables
{
    using System.Xml;

    ///
    /// Abstract calls to FileSystem
    ///
    internal interface IFileSystem
    {
        /// Determines whether the specified file exists.
        /// <param name="path">The file to check.</param>
        bool FileExists(string path);
        /// Returns the content of the specified file
        /// <param name="path">The file to load.</param>
        XmlReader LoadXmlFile(string path);
    }
}


text:
Ext.define('PieCalculator', {
    config: {
        calculationType: undefined,
        field: undefined
    },

    constructor: function(config) {
        this.initConfig(config);
    },

    prepareChartData: function(store) {
        var categories, seriesData, data;
        if(this.calculationType === 'count') {
            data = _.countBy(store.getRange(), function(record) {
                return record.get(this.field);
            }, this);
            categories = _.keys(data);
            seriesData = [];
            _.each(data, function(value, key) {
                seriesData.push([key, value]);
            });
        } else {
            data = _.groupBy(store.getRange(), function(record) {
                return record.get(this.field);
            }, this);
            categories = _.keys(data);
            seriesData = [];
            _.each(data, function(value, key) {
                seriesData.push([key, _.reduce(value, function(total, r) {
                    return total + r.get('PlanEstimate');
                }, 0)]);
            });
        }

        return {
            categories: categories,
            series: [
                {
                    type: 'pie',
                    data: seriesData
                }
            ]
        };
    }
});


text:
=head1 LICENSE

Copyright [1999-2015] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute
Copyright [2016-2022] EMBL-European Bioinformatics Institute

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.

=cut

package EnsEMBL::Web::Component::Transcript::DomainSpreadsheet;

use strict;

use base qw(EnsEMBL::Web::Component::Transcript);

sub _init {
  my $self = shift;
  $self->cacheable(1);
  $self->ajaxable(1);
}

sub content {
  my $self        = shift;
  my $object      = $self->object;
  my $translation = $object->translation_object;

  return $self->non_coding_error unless $translation;

  my $hub      = $self->hub;
  my $analyses = $object->table_info($object->get_db, 'protein_feature')->{'analyses'} || {};
  my (@others, @domains);

  foreach (keys %$analyses) {
    if ($analyses->{$_}{'web'}{'type'} eq 'domain') {
      push @domains, @{$translation->get_all_ProteinFeatures($_)};
    } else {
      push @others,  @{$translation->get_all_ProteinFeatures($_)};
    }
  }

  my @domain_keys = grep { $analyses->{$_}{'web'}{'type'} eq 'domain' } keys %$analyses;
  my @other_keys  = grep { $analyses->{$_}{'web'}{'type'} ne 'domain' } keys %$analyses;
  my @domains     = map  { @{$translation->get_all_ProteinFeatures($_)} } @domain_keys;
  my @others      = map  { @{$translation->get_all_ProteinFeatures($_)} } @other_keys;

  return unless @others || @domains;

  my $html = '';

  if (@domains) {
    my $table = $self->new_table([], [], { data_table => 1 });

    $table->add_columns(
      { key => 'type',     title => 'Domain source', width => '15%', sort => 'string', help => 'Original project that identified the domain' },
      { key => 'start',    title => 'Start',       width => '10%',   sort => 'numeric', hidden_key => '_loc' },
      { key => 'end',      title => 'End',         width => '10%',   sort => 'numeric'                       },
      { key => 'desc',     title => 'Description', width => '15%',   sort => 'string'                        },
      { key => 'acc',      title => 'Accession',   width => '10%',   sort => 'html'                          },
      { key => 'interpro', title => 'InterPro',    width => '40%',   sort => 'html'                          }
    );

    foreach my $domain (
      sort {
        $a->idesc cmp $b->idesc ||
        $a->start <=> $b->start ||
        $a->end   <=> $b->end   ||
        $a->analysis->db cmp $b->analysis->db
      } @domains
    ) {
      my $db            = $domain->analysis->db;
      my $id            = $domain->hseqname;
      my $interpro_acc  = $domain->interpro_ac;
      my $interpro_link = $hub->get_ExtURL_link($interpro_acc,'INTERPRO',$interpro_acc);
      my $other_urls;

      if ($interpro_acc) {
        my $url     = $hub->url({ action => 'Domains/Genes', domain => $interpro_acc });
        $other_urls = qq{ [Display all genes with this domain]};
      } else {
        $interpro_link = '-';
        $other_urls = '';
      }

      $table->add_row({
        type     => $db,
        desc     => $domain->hdescription || $domain->idesc || '-',
        acc      => $hub->get_ExtURL_link($id, uc $db, $id),
        start    => $domain->start,
        end      => $domain->end,
        interpro => $interpro_link.$other_urls,
        _loc     => join('::', $domain->start, $domain->end),
      });
    }

    $html .= '
Domains
' . $table->render;
  }

  if (@others) {
    my $table = $self->new_table([], [], { data_table => 1 });

    $table->add_columns(
      { key => 'type',  title => 'Feature type', width => '40%', sort => 'string'                        },
      { key => 'start', title => 'Start',        width => '30%', sort => 'numeric', hidden_key => '_loc' },
      { key => 'end',   title => 'End',          width => '30%', sort => 'numeric'                       }
    );

    foreach my $domain (
      sort { $a->[0] cmp $b->[0] || $a->[1]->start <=> $b->[1]->start || $a->[1]->end <=> $b->[1]->end }
      map {[ $_->analysis->db || $_->analysis->logic_name || 'unknown', $_ ]}
      @others
    ) {
      (my $domain_type = $domain->[0]) =~ s/_/ /g;

      $table->add_row({
        type  => ucfirst $domain_type,
        start => $domain->[1]->start,
        end   => $domain->[1]->end,
        _loc  => join('::', $domain->[1]->start, $domain->[1]->end),
      });
    }

    $html .= '
Other features
' . $table->render;
  }

  return $html;
}

1;


text:
/*
Author: Tomasz Niedziela-Brach
 */
package dataset;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

public class Event {
    public HashMap<String, Occurance> occurances;

    public Event(){ occurances = new HashMap<String, Occurance>(); }
    public Event(HashMap<String, Occurance> occurances)
    {
        this.occurances = occurances;
    }

    public void addOccurance(String key, Occurance occurance){ this.occurances.put(key, occurance); }

    public void removeOccurance(String key){ this.occurances.remove(key); }

    public boolean VerifyRow(HashMap<String, Object> row)
    {
        for(Map.Entry<String, Occurance> entry : occurances.entrySet())
        {
            String key = entry.getKey();
            Occurance occurance = entry.getValue();
            if(!row.containsKey(key) || !(occurance.CheckValue(row.get(key)))){
                return false;
            }
        }
        return true;
    }
}