text:
/*
 * Copyright 2005 MH-Software-Entwicklung. All rights reserved.
 * Use is subject to license terms.
 */
package vnmr.vplaf.jtattoo.hifi;

import vnmr.vplaf.jtattoo.*;
import java.util.*;
import javax.swing.UIDefaults;

/**
 * @author Michael Hagen
 */
public class HiFiLookAndFeel extends AbstractLookAndFeel {

    private static HiFiDefaultTheme myTheme = null;

    private static final ArrayList themesList = new ArrayList();
    private static final HashMap themesMap = new HashMap();
    private static final Properties defaultProps = new Properties();
    private static final Properties smallFontProps = new Properties();
    private static final Properties largeFontProps = new Properties();
    private static final Properties giantFontProps = new Properties();

    static {
        smallFontProps.setProperty("controlTextFont", "Dialog bold 10");
        smallFontProps.setProperty("systemTextFont", "Dialog bold 10");
        smallFontProps.setProperty("userTextFont", "Dialog 10");
        smallFontProps.setProperty("menuTextFont", "Dialog bold 10");
        smallFontProps.setProperty("windowTitleFont", "Dialog bold 10");
        smallFontProps.setProperty("subTextFont", "Dialog 8");

        largeFontProps.setProperty("controlTextFont", "Dialog bold 14");
        largeFontProps.setProperty("systemTextFont", "Dialog bold 14");
        largeFontProps.setProperty("userTextFont", "Dialog bold 14");
        largeFontProps.setProperty("menuTextFont", "Dialog bold 14");
        largeFontProps.setProperty("windowTitleFont", "Dialog bold 14");
        largeFontProps.setProperty("subTextFont", "Dialog 12");

        giantFontProps.setProperty("controlTextFont", "Dialog 18");
        giantFontProps.setProperty("systemTextFont", "Dialog 18");
        giantFontProps.setProperty("userTextFont", "Dialog 18");
        giantFontProps.setProperty("menuTextFont", "Dialog 18");
        giantFontProps.setProperty("windowTitleFont", "Dialog 18");
        giantFontProps.setProperty("subTextFont", "Dialog 16");

        themesList.add("Default");
        themesList.add("Small-Font");
        themesList.add("Large-Font");
        themesList.add("Giant-Font");

        themesMap.put("Default", defaultProps);
        themesMap.put("Small-Font", smallFontProps);
        themesMap.put("Large-Font", largeFontProps);
        themesMap.put("Giant-Font", giantFontProps);
    }

    public static java.util.List getThemes() {
        return themesList;
    }

    public static Properties getThemeProperties(String name) {
        return ((Properties) themesMap.get(name));
    }

    public static void setTheme(String name) {
        if (myTheme != null) {
            HiFiDefaultTheme.setInternalName(name);
        }
        setTheme((Properties) themesMap.get(name));
    }

    public static void setTheme(String name, String licenseKey, String logoString) {
        Properties props = (Properties) themesMap.get(name);
        props.put("licenseKey", licenseKey);
        props.put("logoString", logoString);
        if (myTheme != null) {
            HiFiDefaultTheme.setInternalName(name);
        }
        setTheme(props);
    }

    public static void setTheme(Properties themesProps) {
        if (myTheme == null) {
            myTheme = new HiFiDefaultTheme();
        }
        if ((myTheme != null) && (themesProps != null)) {
            myTheme.setUpColor();
            myTheme.setProperties(themesProps);
            myTheme.setUpColorArrs();
            AbstractLookAndFeel.setTheme(myTheme);
        }
    }

    public static void setCurrentTheme(Properties themesProps) {
        setTheme(themesProps);
    }

    public String getName() {
        return "HiFi";
    }

    public String getID() {
        return "HiFi";
    }

    public String getDescription() {
        return "The HiFi Look and Feel";
    }

    public boolean isNativeLookAndFeel() {
        return false;
    }

    public boolean isSupportedLookAndFeel() {
        return true;
    }

    public AbstractBorderFactory getBorderFactory() {
        return HiFiBorderFactory.getInstance();
    }

    public AbstractIconFactory getIconFactory() {
        return HiFiIconFactory.getInstance();
    }

    protected void createDefaultTheme() {
        if (myTheme == null) {
            myTheme = new HiFiDefaultTheme();
        }
        setTheme(myTheme);
    }

    protected void initClassDefaults(UIDefaults table) {
        super.initClassDefaults(table);
        Object[] uiDefaults = {
            // BaseLookAndFeel classes
            "SeparatorUI", BaseSeparatorUI.class.getName(),
            "TextFieldUI", BaseTextFieldUI.class.getName(),
            "TextAreaUI", BaseTextAreaUI.class.getName(),
            "EditorPaneUI", BaseEditorPaneUI.class.getName(),
            "PasswordFieldUI", BasePasswordFieldUI.class.getName(),
            "ToolTipUI", BaseToolTipUI.class.getName(),
            "TreeUI", BaseTreeUI.class.getName(),
            "TableUI", BaseTableUI.class.getName(),
            "TableHeaderUI", BaseTableHeaderUI.class.getName(),
            "SplitPaneUI", BaseSplitPaneUI.class.getName(),
            "ProgressBarUI", BaseProgressBarUI.class.getName(),
            "FileChooserUI", BaseFileChooserUI.class.getName(),
            "MenuUI", BaseMenuUI.class.getName(),
            "PopupMenuUI", BasePopupMenuUI.class.getName(),
            "MenuItemUI", BaseMenuItemUI.class.getName(),
            "CheckBoxMenuItemUI", BaseCheckBoxMenuItemUI.class.getName(),
            "RadioButtonMenuItemUI", BaseRadioButtonMenuItemUI.class.getName(),
            "PopupMenuSeparatorUI", BaseSeparatorUI.class.getName(),
            "DesktopPaneUI", BaseDesktopPaneUI.class.getName(),

            // HiFiLookAndFeel classes
            "LabelUI", HiFiLabelUI.class.getName(),
            "CheckBoxUI", HiFiCheckBoxUI.class.getName(),
            "RadioButtonUI", HiFiRadioButtonUI.class.getName(),
            "ButtonUI", HiFiButtonUI.class.getName(),
            "ToggleButtonUI", HiFiToggleButtonUI.class.getName(),
            "ComboBoxUI", HiFiComboBoxUI.class.getName(),
            "SliderUI", HiFiSliderUI.class.getName(),
            "PanelUI", HiFiPanelUI.class.getName(),
            "ScrollPaneUI", HiFiScrollPaneUI.class.getName(),
            "TabbedPaneUI", HiFiTabbedPaneUI.class.getName(),
            "ScrollBarUI", HiFiScrollBarUI.class.getName(),
            "ToolBarUI", HiFiToolBarUI.class.getName(),
            "MenuBarUI", HiFiMenuBarUI.class.getName(),
            "InternalFrameUI", HiFiInternalFrameUI.class.getName(),
            "RootPaneUI", HiFiRootPaneUI.class.getName(),};
        table.putDefaults(uiDefaults);
        if (JTattooUtilities.getJavaVersion() >= 1.5) {
            table.put("FormattedTextFieldUI", BaseFormattedTextFieldUI.class.getName());
            table.put("SpinnerUI", BaseSpinnerUI.class.getName());
        }
    }
}


text:
package net.metanotion.util;

import java.lang.reflect.Field;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import net.metanotion.util.reflect.ExtensionWalker;
import net.metanotion.util.reflect.GetFieldList;

/** Use reflection to generate a suitable implementation of Unknown.lookupInterface(...).
	This class provides a way to simply and controllable provide an object with an implementation of
	Unknown. It uses reflection to examine the class of an object, and will "provide" an implementation of
	a given interface based on the following heuristics:

Any interface implemented by the object(by enumerating the interfaces it implements)

Any instance variable annotated with {@link net.metanotion.util.Service} will be exanimed for the
			interfaces implemented by the type associated with that instance variable.

Any instance variable annotated with {@link net.metanotion.util.Extends} will have these rules applied
			recursively to it.

	In essence, those two annotations provide a sort of runtime "inheritance/delegation" pattern that this class uses
	to determine if the "component" implements an interface.
*/
public final class UnknownMagic {
	private static final Logger logger = LoggerFactory.getLogger(UnknownMagic.class);

	private final class Visitor implements ExtensionWalker.ClassVisitor {
		@Override public void visit(final Field[] stack, final Class current) {
			if(stack.length == 0) { recurseInterfaces(stack, current); }
			for(final Field f: current.getFields()) {
				f.setAccessible(true);
				if(f.getAnnotation(Service.class) != null) {
					final Class type = f.getType();
					final Field[] f1 = Arrays.copyOf(stack, stack.length + 1);
					f1[stack.length] = f;
					map.put(type, new GetFieldList(f1));
					recurseInterfaces(f1, type);
				}
			}
		}

		private void recurseInterfaces(final Field[] prev, final Class current) {
			for(final Class c: current.getInterfaces()) {
				logger.debug(" implementing " + c.getName());
				if(!(map.containsKey(c))) {
					map.put(c, (prev.length == 0) ? IdentityDictionary.INSTANCE : new GetFieldList(prev));
				}
				recurseInterfaces(prev, c);
			}
		}
	}

	private final Map<Class,Dictionary> map = new HashMap<>();
	private final String clsName;

	/** Create an implementation of Unkonwn.lookupInterface(...) for the class provided to the constructor.
		@param klazz The class to introspect on.
	*/
	public UnknownMagic(final Class klazz) {
		this.clsName = klazz.getName();
		logger.debug("Processing {}", this.clsName);
		ExtensionWalker.visit(new Visitor(), klazz);
	}

	/** To use this implementation of lookupInterface(...) you could implement Unknown. Then:

		public <I> I lookupInterface(Class<I> theInterface) {

		    return instanceOfUnknownMagic.lookupInterface(theInterface, this);

		}
		@param  The type of the interface to return.
		@param theInterface The service requested from the component.
		@param instance The component that will provide an implementation of the service.
		@return An instance of an object that implements theInterface.
	*/
	public  I lookupInterface(final Class theInterface, final Object instance) {
		if(theInterface == Unknown.class) { return (I) instance; }
		if(theInterface == Object.class) { return (I) instance; }
		final Dictionary g = map.get(theInterface);
		if(g==null) {
			throw new RuntimeException("no suitable proxy found for: " + theInterface.getName()
				+ " in " + this.clsName);
		}
		return (I) g.get(instance);
	}
}

redpajama_set_name: RedPajamaGithub


text:
namespace Microsoft.eShopOnContainers.WebMVC.ViewModels;

public record Header
{
    public string Controller { get; init; }
    public string Text { get; init; }
}


text:
package test.github1336;

import java.util.Random;
import java.util.concurrent.TimeUnit;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;

public class BaseClass {
  private FakeDriver driver;

  @BeforeClass
  public void beforeClass() {
    driver = new FakeDriver();
  }

  private FakeDriver getDriver() {
    return driver;
  }

  public static class FakeDriver {
    private String url;

    public void get(String url) {
      this.url = url;
    }

    String getCurrentUrl() {
      try {
        TimeUnit.SECONDS.sleep(new Random().nextInt(10));
        return url;
      } catch (InterruptedException e) {
        return url;
      }
    }
  }

  void runTest(String url) {
    getDriver().get(url);
    Assert.assertEquals(getDriver().getCurrentUrl(), url);
  }
}


text:
layout: post
title: "Huggies Commercial"
date: 2008-06-12 11:59:32
---
This Huggies commercial is just too funny.


text:
package org.axonframework.serializer.xml;

import org.axonframework.serializer.SerializedObject;
import org.axonframework.serializer.SimpleSerializedObject;
import org.axonframework.serializer.SimpleSerializedType;
import org.dom4j.Document;
import org.dom4j.DocumentFactory;
import org.junit.*;

import static org.junit.Assert.*;

/**
 * @author Allard Buijze
 */
public class Dom4JToByteArrayConverterTest {

    private Dom4JToByteArrayConverter testSubject;
    private SimpleSerializedType serializedType;

    @Before
    public void setUp() throws Exception {
        testSubject = new Dom4JToByteArrayConverter();
        serializedType = new SimpleSerializedType("custom", "0");
    }

    @Test
    public void testCanConvert() {
        assertEquals(Document.class, testSubject.expectedSourceType());
        assertEquals(byte[].class, testSubject.targetType());
    }

    @Test
    public void testConvert() throws Exception {
        DocumentFactory df = DocumentFactory.getInstance();
        Document doc = df.createDocument("UTF-8");
        doc.setRootElement(df.createElement("rootElement"));

        SimpleSerializedObject<Document> original = new SimpleSerializedObject<Document>(doc,
                                                                                Document.class,
                                                                                serializedType);
        SerializedObject<byte[]> actual = testSubject.convert(original);

        assertNotNull(actual);
        assertNotNull(actual.getData());
        String actualString = new String(actual.getData());

        assertTrue("Wrong output: " + actualString, actualString.contains("rootElement"));
    }
}


text:
class FileDataController < ApplicationController
  def download
    file = FileDatum.find(params[:id])
    send_file file.file.path if file
    download_log(file)
  end

  def download_log(file)
    dl = DownloadLog.new
    dl.user_id = current_user.id
    dl.file_datum_id = file.id
    dl.save
  end

  def download_history
    @download_logs = DownloadLog.all
    authorize! :read, DownloadLog
  end
end


text:
#ifndef LINGER_BOOTSTRAP_H_
#define LINGER_BOOTSTRAP_H_

extern zend_class_entry *bootstrap_ce;

#endif /* LINGER_BOOTSTRAP_H_ */


text:
///////////////////////////////////////////////////////////////////////////////////
//	Copyright 2017 shushen,ye
//	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.
///////////////////////////////////////////////////////////////////////////////////

#include "StdAfx.h"
#include "ObjectSystem.h"

/*
template<class ValType,class SerType>
ObjectTypeWrap<ValType,SerType>::ObjectTypeWrap()
{
	m_ObjectState.bLock=FALSE;
	m_ObjectState.nLockTime=0;
	m_ObjectState.nType=CObjectSystemInterface::Nonmoral;
	m_ObjectState.szLockUser=_T("");
}

template<class ValType,class SerType>
virtual ObjectTypeWrap<ValType,SerType>::~ObjectTypeWrap(){};

template<class ValType,class SerType>
BOOL ObjectTypeWrap<ValType,SerType>::GetObject()
{
	tstring Object;
	BOOL bRet=gpObjectSystem->GetObject(m_szAddr,Object,m_ObjectState,&m_nCurError);
	if(bRet)
	{
		SerTCHARXmlBufferToObjectEx(ValType,SerType,m_Data,(Object.c_str()));
	}
	return bRet;

}
template<class ValType,class SerType>
BOOL ObjectTypeWrap<ValType,SerType>::UpDataObject()
{
	tstring Object;
	SerObjectToXmlBufferEx(ValType,SerType,m_Data,Object);
	return gpObjectSystem->UpDataObject(m_szAddr,Object,&m_nCurError);
}

template<class ValType,class SerType>
BOOL ObjectTypeWrap<ValType,SerType>::GetDirectoryInfo(CObjectSystemInterface::_tagDirectoryInfo & DirectoryInfo)
{
	return gpObjectSystem->GetDirectoryInfo(m_szAddr,m_szFinder,DirectoryInfo,&m_nCurError);
}

template<class ValType,class SerType>
BOOL ObjectTypeWrap<ValType,SerType>::DeleteObject()
{
	return gpObjectSystem->DeleteObject(m_szAddr,&m_nCurError);
}*/


text:
// Copyright (c) 2008-2022, Hazelcast, Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// <auto-generated>
//   This code was generated by a tool.
//     Hazelcast Client Protocol Code Generator
//     https://github.com/hazelcast/hazelcast-client-protocol
//   Change to this file will be lost if the code is regenerated.
// </auto-generated>

#pragma warning disable IDE0051 // Remove unused private members
// ReSharper disable UnusedMember.Local
// ReSharper disable RedundantUsingDirective
// ReSharper disable CheckNamespace

using System;
using System.Threading;
using System.Threading.Tasks;
using System.Collections.Generic;
using Hazelcast.Protocol.BuiltInCodecs;
using Hazelcast.Protocol.CustomCodecs;
using Hazelcast.Core;
using Hazelcast.Messaging;
using Hazelcast.Clustering;
using Hazelcast.Serialization;
using Microsoft.Extensions.Logging;

namespace Hazelcast.Protocol.Codecs
{
    ///
    /// Returns the collection of values associated with the key.
    ///
#if SERVER_CODEC
    internal static class TransactionalMultiMapGetServerCodec
#else
    internal static class TransactionalMultiMapGetCodec
#endif
    {
        public const int RequestMessageType = 983552; // 0x0F0200
        public const int ResponseMessageType = 983553; // 0x0F0201
        private const int RequestTxnIdFieldOffset = Messaging.FrameFields.Offset.PartitionId + BytesExtensions.SizeOfInt;
        private const int RequestThreadIdFieldOffset = RequestTxnIdFieldOffset + BytesExtensions.SizeOfGuid;
        private const int RequestInitialFrameSize = RequestThreadIdFieldOffset + BytesExtensions.SizeOfLong;
        private const int ResponseInitialFrameSize = Messaging.FrameFields.Offset.ResponseBackupAcks + BytesExtensions.SizeOfByte;

#if SERVER_CODEC
        public sealed class RequestParameters
        {

            ///
            /// Name of the Transactional Multi Map
            ///
            public string Name { get; set; }

            ///
            /// ID of the transaction
            ///
            public Guid TxnId { get; set; }

            ///
            /// The id of the user thread performing the operation. It is used to guarantee that only the lock holder thread (if a lock exists on the entry) can perform the requested operation.
            ///
            public long ThreadId { get; set; }

            ///
            /// The key whose associated values are returned
            ///
            public IData Key { get; set; }
        }
#endif

        public static ClientMessage EncodeRequest(string name, Guid txnId, long threadId, IData key)
        {
            var clientMessage = new ClientMessage
            {
                IsRetryable = false,
                OperationName = "TransactionalMultiMap.Get"
            };
            var initialFrame = new Frame(new byte[RequestInitialFrameSize], (FrameFlags) ClientMessageFlags.Unfragmented);
            initialFrame.Bytes.WriteIntL(Messaging.FrameFields.Offset.MessageType, RequestMessageType);
            initialFrame.Bytes.WriteIntL(Messaging.FrameFields.Offset.PartitionId, -1);
            initialFrame.Bytes.WriteGuidL(RequestTxnIdFieldOffset, txnId);
            initialFrame.Bytes.WriteLongL(RequestThreadIdFieldOffset, threadId);
            clientMessage.Append(initialFrame);
            StringCodec.Encode(clientMessage, name);
            DataCodec.Encode(clientMessage, key);
            return clientMessage;
        }

#if SERVER_CODEC
        public static RequestParameters DecodeRequest(ClientMessage clientMessage)
        {
            using var iterator = clientMessage.GetEnumerator();
            var request = new RequestParameters();
            var initialFrame = iterator.Take();
            request.TxnId = initialFrame.Bytes.ReadGuidL(RequestTxnIdFieldOffset);
            request.ThreadId = initialFrame.Bytes.ReadLongL(RequestThreadIdFieldOffset);
            request.Name = StringCodec.Decode(iterator);
            request.Key = DataCodec.Decode(iterator);
            return request;
        }
#endif

        public sealed class ResponseParameters
        {

            ///
            /// The collection of the values associated with the key
            ///
            public IList<IData> Response { get; set; }
        }

#if SERVER_CODEC
        public static ClientMessage EncodeResponse(ICollection<IData> response)
        {
            var clientMessage = new ClientMessage();
            var initialFrame = new Frame(new byte[ResponseInitialFrameSize], (FrameFlags) ClientMessageFlags.Unfragmented);
            initialFrame.Bytes.WriteIntL(Messaging.FrameFields.Offset.MessageType, ResponseMessageType);
            clientMessage.Append(initialFrame);
            ListMultiFrameCodec.Encode(clientMessage, response, DataCodec.Encode);
            return clientMessage;
        }
#endif

        public static ResponseParameters DecodeResponse(ClientMessage clientMessage)
        {
            using var iterator = clientMessage.GetEnumerator();
            var response = new ResponseParameters();
            iterator.Take(); // empty initial frame
            response.Response = ListMultiFrameCodec.Decode(iterator, DataCodec.Decode);
            return response;
        }

    }
}


text:
raven-node is a Node.js client for [Sentry](https://getsentry.com/).

## Resources

* [Documentation](https://docs.getsentry.com/hosted/clients/node/)
* [Bug Tracker](https://github.com/getsentry/raven-node/issues)
* [IRC](irc://chat.freenode.net/sentry) (chat.freenode.net, #sentry)


text:
package com.microsoft.azure.keyvault.models;

import com.fasterxml.jackson.annotation.JsonProperty;

/**
 * The certificate issuer set parameters.
 */
public class CertificateIssuerSetParameters {
    /**
     * The issuer provider.
     */
    @JsonProperty(value = "provider", required = true)
    private String provider;

    /**
     * The credentials to be used for the issuer.
     */
    @JsonProperty(value = "credentials")
    private IssuerCredentials credentials;

    /**
     * Details of the organization as provided to the issuer.
     */
    @JsonProperty(value = "org_details")
    private OrganizationDetails organizationDetails;

    /**
     * Attributes of the issuer object.
     */
    @JsonProperty(value = "attributes")
    private IssuerAttributes attributes;

    /**
     * Get the provider value.
     *
     * @return the provider value
     */
    public String provider() {
        return this.provider;
    }

    /**
     * Set the provider value.
     *
     * @param provider the provider value to set
     * @return the CertificateIssuerSetParameters object itself.
     */
    public CertificateIssuerSetParameters withProvider(String provider) {
        this.provider = provider;
        return this;
    }

    /**
     * Get the credentials value.
     *
     * @return the credentials value
     */
    public IssuerCredentials credentials() {
        return this.credentials;
    }

    /**
     * Set the credentials value.
     *
     * @param credentials the credentials value to set
     * @return the CertificateIssuerSetParameters object itself.
     */
    public CertificateIssuerSetParameters withCredentials(IssuerCredentials credentials) {
        this.credentials = credentials;
        return this;
    }

    /**
     * Get the organizationDetails value.
     *
     * @return the organizationDetails value
     */
    public OrganizationDetails organizationDetails() {
        return this.organizationDetails;
    }

    /**
     * Set the organizationDetails value.
     *
     * @param organizationDetails the organizationDetails value to set
     * @return the CertificateIssuerSetParameters object itself.
     */
    public CertificateIssuerSetParameters withOrganizationDetails(OrganizationDetails organizationDetails) {
        this.organizationDetails = organizationDetails;
        return this;
    }

    /**
     * Get the attributes value.
     *
     * @return the attributes value
     */
    public IssuerAttributes attributes() {
        return this.attributes;
    }

    /**
     * Set the attributes value.
     *
     * @param attributes the attributes value to set
     * @return the CertificateIssuerSetParameters object itself.
     */
    public CertificateIssuerSetParameters withAttributes(IssuerAttributes attributes) {
        this.attributes = attributes;
        return this;
    }

}


text:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC
  "-//mybatis.org//DTD Mapper 3.0//EN"
  "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.moemao.tgks.cgms.lovelive.dao.LoveLiveDao">
    <resultMap id="LoveLiveEvtMap" type="LoveLiveEvt">
        <id property="id" column="ID" />
        <result property="cardId" column="CARDID" />
        <result property="girl" column="GIRL" />
        <result property="rarity" column="RARITY" />
        <result property="type" column="TYPE" />
        <result property="imageUrl" column="IMAGEURL" />
        <result property="imageTUrl" column="IMAGETURL" />
        <result property="maxLevel" column="MAXLEVEL" />
        <result property="minHP" column="MINHP" />
        <result property="minSmile" column="MINSMILE" />
        <result property="minPure" column="MINPURE" />
        <result property="minCool" column="MINCOOL" />
        <result property="maxHP" column="MAXHP" />
        <result property="maxSmile" column="MAXSMILE" />
        <result property="maxPure" column="MAXPURE" />
        <result property="maxCool" column="MAXCOOL" />
        <result property="appeal" column="APPEAL" />
        <result property="appealInfo" column="APPEALINFO" />
        <result property="centerSkill" column="CENTERSKILL" />
        <result property="centerSkillInfo" column="CENTERSKILLINFO" />
        <result property="createTime" column="CREATETIME" />
        <result property="remark" column="REMARK" />
    </resultMap>
</mapper>


text:
<?php

// Call Zend_Controller_Action_Helper_ViewRendererTest::main() if this source file is executed directly.
if (!defined("PHPUnit_MAIN_METHOD")) {
    define("PHPUnit_MAIN_METHOD", "Zend_Controller_Action_Helper_ViewRendererTest::main");
}

require_once 'Zend/Controller/Action/Helper/ViewRenderer.php';
require_once 'Zend/Controller/Front.php';
require_once 'Zend/Controller/Request/Http.php';
require_once 'Zend/Controller/Response/Http.php';
require_once 'Zend/Filter/Inflector.php';
require_once 'Zend/View.php';

require_once dirname(__FILE__) . '/../../_files/modules/foo/controllers/IndexController.php';
require_once dirname(__FILE__) . '/../../_files/modules/bar/controllers/IndexController.php';

/**
 * Test class for Zend_Controller_Action_Helper_ViewRenderer.
 *
 * @category   Zend
 * @package    Zend_Controller
 * @subpackage UnitTests
 * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 * @group      Zend_Controller
 * @group      Zend_Controller_Action
 * @group      Zend_Controller_Action_Helper
 */
class Zend_Controller_Action_Helper_ViewRendererTest extends PHPUnit_Framework_TestCase
{
    /**
     * Base path to controllers, views
     * @var string
     */
    public $basePath;

    /**
     * Front controller object
     * @var Zend_Controller_Front
     */
    public $front;

    /**
     * ViewRenderer helper
     * @var Zend_Controller_Action_Helper_ViewRenderer
     */
    public $helper;

    /**
     * Request object
     * @var Zend_Controller_Request_Http
     */
    public $request;

    /**
     * Response object
     * @var Zend_Controller_Response_Http
     */
    public $response;

    /**
     * Runs the test methods of this class.
     *
     * @access public
     * @static
     */
    public static function main()
    {
        $suite  = new PHPUnit_Framework_TestSuite("Zend_Controller_Action_Helper_ViewRendererTest");
        $result = PHPUnit_TextUI_TestRunner::run($suite);
    }

    /**
     * Sets up the fixture, for example, open a network connection.
     * This method is called before a test is executed.
     *
     * @access protected
     */
    protected function setUp()
    {
        $this->basePath = realpath(dirname(__FILE__) . str_repeat(DIRECTORY_SEPARATOR . '..', 2));
        $this->request  = new Zend_Controller_Request_Http();
        $this->response = new Zend_Controller_Response_Http();
        $this->front    = Zend_Controller_Front::getInstance();
        $this->front->resetInstance();
        $this->front->addModuleDirectory($this->basePath . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'modules')
                    ->setRequest($this->request)
                    ->setResponse($this->response);

        $this->helper   = new Zend_Controller_Action_Helper_ViewRenderer();
        Zend_Controller_Action_HelperBroker::addHelper($this->helper);
    }

    /**
     * Tears down the fixture, for example, close a network connection.
     * This method is called after a test is executed.
     *
     * @access protected
     */
    protected function tearDown()
    {
        Zend_Controller_Action_HelperBroker::resetHelpers();
    }

    public function testConstructorSetsViewWhenPassed()
    {
        $view   = new Zend_View();
        $helper = new Zend_Controller_Action_Helper_ViewRenderer($view);
        $this->assertNotNull(isset($helper->view));
        $this->assertSame($view, $helper->view);
    }

    public function testConstructorSetsOptionsWhenPassed()
    {
        $helper = new Zend_Controller_Action_Helper_ViewRenderer(null, array(
            'neverRender'     => true,
            'noRender'        => true,
            'noController'    => true,
            'viewSuffix'      => 'php',
            'scriptAction'    => 'foo',
            'responseSegment' => 'baz'
        ));

        $this->assertTrue($helper->getNeverRender());
        $this->assertTrue($helper->getNoRender());
        $this->assertTrue($helper->getNoController());
        $this->assertEquals('php', $helper->getViewSuffix());
        $this->assertEquals('foo', $helper->getScriptAction());
        $this->assertEquals('baz', $helper->getResponseSegment());
    }

    public function testSetView()
    {
        $view = new Zend_View();
        $this->helper->setView($view);
        $this->assertSame($view, $this->helper->view);
    }

    public function testGetFrontController()
    {
        $this->assertSame($this->front, $this->helper->getFrontController());
    }

    protected function _checkDefaults($module = 'foo', $count = 1)
    {
        $this->assertTrue(isset($this->helper->view));
        $this->assertTrue($this->helper->view instanceof Zend_View);
        $this->assertFalse($this->helper->getNeverRender());
        $this->assertFalse($this->helper->getNoRender());
        $this->assertNull($this->helper->getResponseSegment());
        $this->assertNull($this->helper->getScriptAction());

        $scriptPaths = $this->helper->view->getScriptPaths();
        $this->assertEquals($count, count($scriptPaths), var_export($scriptPaths, 1));
        $this->assertContains($module, $scriptPaths[0]);

        $helperPaths = $this->helper->view->getHelperPaths();
        $test        = ucfirst($module) . '_View_Helper_';
        $found       = false;
        foreach ($helperPaths as $prefix => $paths) {
            if ($test == $prefix) {
                $found = true;
            }
        }
        $this->assertTrue($found, 'Did not find auto-initialized helper path: ' . var_export($helperPaths, 1));

        $filterPaths = $this->helper->view->getFilterPaths();
        $test        = ucfirst($module) . '_View_Filter_';
        $found = false;
        foreach ($filterPaths as $prefix => $paths) {
            if ($test == $prefix) {
                $found = true;
            }
        }
        $this->assertTrue($found, 'Did not find auto-initialized filter path: ' . var_export($filterPaths, 1));
    }

    public function testInitViewWithDefaults()
    {
        $this->request->setModuleName('foo')
                      ->setControllerName('index');

        $controller = new Foo_IndexController($this->request, $this->response, array());
        $this->helper->setActionController($controller);
        $this->helper->initView();
        $this->_checkDefaults();
    }

    public function testInitViewWillNotRegisterSameViewPathTwice()
    {
        $this->request->setModuleName('foo')
                      ->setControllerName('index');
        $controller = new Foo_IndexController($this->request, $this->response, array());
        $this->helper->setActionController($controller);

        $this->helper->initView();

        $moduleDir = dirname($this->front->getControllerDirectory('foo'));
        $this->helper->initView($moduleDir . '/views', 'Foo', array('encoding' => 'ISO-8858-1'));
        $this->_checkDefaults();
    }

    public function testInitViewCanBeCalledAfterPostDispatch()
    {
        $this->request->setModuleName('foo')
                      ->setControllerName('index');
        $controller = new Foo_IndexController($this->request, $this->response, array());
        $this->helper->setActionController($controller);

        $this->helper->initView();
        $this->helper->setNoRender();
        $this->helper->postDispatch();
        $this->request->setModuleName('bar')
                      ->setControllerName('index');
        $controller = new Bar_IndexController($this->request, $this->response, array());
        $this->helper->setActionController($controller);
        $this->helper->initView();
        $this->_checkDefaults('bar', 2);
    }

    public function testPreDispatchWithDefaults()
    {
        $this->request->setModuleName('foo')
                      ->setControllerName('index');
        $controller = new Foo_IndexController($this->request, $this->response, array());
        $this->helper->setActionController($controller);

        $this->helper->preDispatch();
        $this->_checkDefaults();
    }

    public function testInitViewWithOptions()
    {
        $this->request->setModuleName('foo')
                      ->setControllerName('index');
        $controller = new Foo_IndexController($this->request, $this->response, array());
        $this->helper->setActionController($controller);

        $viewDir = dirname(__FILE__) . str_repeat(DIRECTORY_SEPARATOR . '..', 2) . DIRECTORY_SEPARATOR . 'views';
        $this->helper->initView($viewDir, 'Baz_Bat', array(
            'neverRender'     => true,
            'noRender'        => true,
            'noController'    => true,
            'viewSuffix'      => 'php',
            'scriptAction'    => 'foo',
            'responseSegment' => 'baz'
        ));

        $this->assertTrue($this->helper->getNeverRender());
        $this->assertTrue($this->helper->getNoRender());
        $this->assertTrue($this->helper->getNoController());
        $this->assertEquals('php', $this->helper->getViewSuffix());
        $this->assertEquals('foo', $this->helper->getScriptAction());
        $this->assertEquals('baz', $this->helper->getResponseSegment());

        $scriptPaths = $this->helper->view->getScriptPaths();
        $scriptPath  = $scriptPaths[0];
        $this->assertContains(
            $this->_normalizePath($viewDir),
            $this->_normalizePath($scriptPath)
            );

        $helperPaths = $this->helper->view->getHelperPaths();
        $found       = false;
        foreach ($helperPaths as $prefix => $paths) {
            if ('Baz_Bat_Helper_' == $prefix) {
                $found = true;
            }
        }
        $this->assertTrue($found, 'Helper prefix not set according to spec: ' . var_export($helperPaths, 1));

        $filterPaths = $this->helper->view->getFilterPaths();
        $found       = false;
        foreach ($filterPaths as $prefix => $paths) {
            if ('Baz_Bat_Filter_' == $prefix) {
                $found = true;
            }
        }
        $this->assertTrue($found, 'Filter prefix not set according to spec' . var_export($filterPaths, 1));
    }

    public function testNeverRenderFlag()
    {
        $this->assertFalse($this->helper->getNeverRender());
        $this->helper->setNeverRender();
        $this->assertTrue($this->helper->getNeverRender());
        $this->helper->setNeverRender(false);
        $this->assertFalse($this->helper->getNeverRender());
        $this->helper->setNeverRender(true);
        $this->assertTrue($this->helper->getNeverRender());
    }

    public function testNeverRenderFlagDisablesRendering()
    {
        $this->helper->setNeverRender();
        $this->request->setModuleName('bar')
                      ->setControllerName('index')
                      ->setActionName('test')
                      ->setDispatched(true);
        $controller = new Bar_IndexController($this->request, $this->response, array());
        $this->helper->setActionController($controller);
        $this->helper->postDispatch();

        $content = $this->response->getBody();
        $this->assertNotContains('Rendered index/test.phtml', $this->response->getBody());
    }

    public function testNoRenderFlag()
    {
        $this->assertFalse($this->helper->getNoRender());
        $this->helper->setNoRender();
        $this->assertTrue($this->helper->getNoRender());
        $this->helper->setNoRender(false);
        $this->assertFalse($this->helper->getNoRender());
        $this->helper->setNoRender(true);
        $this->assertTrue($this->helper->getNoRender());
    }

    public function testScriptActionProperty()
    {
        $this->assertNull($this->helper->getScriptAction());
        $this->helper->setScriptAction('foo');
        $this->assertEquals('foo', $this->helper->getScriptAction());
        $this->helper->setScriptAction('foo/bar');
        $this->assertEquals('foo/bar', $this->helper->getScriptAction());
    }

    public function testResponseSegmentProperty()
    {
        $this->assertNull($this->helper->getResponseSegment());
        $this->helper->setResponseSegment('foo');
        $this->assertEquals('foo', $this->helper->getResponseSegment());
        $this->helper->setResponseSegment('foo/bar');
        $this->assertEquals('foo/bar', $this->helper->getResponseSegment());
    }

    public function testNoControllerFlag()
    {
        $this->assertFalse($this->helper->getNoController());
        $this->helper->setNoController();
        $this->assertTrue($this->helper->getNoController());
        $this->helper->setNoController(false);
        $this->assertFalse($this->helper->getNoController());
        $this->helper->setNoController(true);
        $this->assertTrue($this->helper->getNoController());
    }

    public function testNeverControllerFlag()
    {
        $this->assertFalse($this->helper->getNeverController());
        $this->helper->setNeverController();
        $this->assertTrue($this->helper->getNeverController());
        $this->helper->setNeverController(false);
        $this->assertFalse($this->helper->getNeverController());
        $this->helper->setNeverController(true);
        $this->assertTrue($this->helper->getNeverController());
    }

    protected function _checkRenderProperties()
    {
        $this->assertEquals('foo', $this->helper->getScriptAction());
        $this->assertEquals('bar', $this->helper->getResponseSegment());
        $this->assertTrue($this->helper->getNoController());
    }

    public function testSetRenderSetsProperties()
    {
        $this->helper->setRender('foo', 'bar', true);
        $this->_checkRenderProperties();
    }

    public function testPostDispatchRendersAppropriateScript()
    {
        $this->request->setModuleName('bar')
                      ->setControllerName('index')
                      ->setActionName('test')
                      ->setDispatched(true);
        $controller = new Bar_IndexController($this->request, $this->response, array());
        $this->helper->setActionController($controller);
        $this->helper->postDispatch();

        $content = $this->response->getBody();
        $this->assertContains('Rendered index/test.phtml in bar module', $content);
    }

    public function testPostDispatchDoesNothingOnForward()
    {
        $this->request->setModuleName('bar')
                      ->setControllerName('index')
                      ->setActionName('test')
                      ->setDispatched(false);
        $controller = new Bar_IndexController($this->request, $this->response, array());
        $this->helper->setActionController($controller);
        $this->helper->postDispatch();

        $content = $this->response->getBody();
        $this->assertNotContains('Rendered index/test.phtml in bar module', $content);
        $this->assertTrue(empty($content));
    }

    public function testPostDispatchDoesNothingOnRedirect()
    {
        $this->request->setModuleName('bar')
                      ->setControllerName('index')
                      ->setActionName('test')
                      ->setDispatched(true);
        $this->response->setHttpResponseCode(302);
        $controller = new Bar_IndexController($this->request, $this->response, array());
        $this->helper->setActionController($controller);
        $this->helper->postDispatch();

        $content = $this->response->getBody();
        $this->assertNotContains('Rendered index/test.phtml in bar module', $content);
        $this->assertTrue(empty($content));
    }

    public function testPostDispatchDoesNothingWithNoController()
    {
        $this->request->setModuleName('bar')
                      ->setControllerName('index')
                      ->setActionName('test')
                      ->setDispatched(true);
        $this->helper->postDispatch();

        $content = $this->response->getBody();
        $this->assertNotContains('Rendered index/test.phtml in bar module', $content);
        $this->assertTrue(empty($content));
    }

    public function testPostDispatchDoesNothingWithNeverController()
    {
        $this->request->setModuleName('bar')
                      ->setControllerName('index')
                      ->setActionName('test')
                      ->setDispatched(true);
        $this->helper->setNeverController(true);
        $this->helper->postDispatch();

        $content = $this->response->getBody();
        $this->assertNotContains('Rendered index/test.phtml in bar module', $content);
        $this->assertTrue(empty($content));
    }

    public function testDirectProxiesToSetRender()
    {
        $this->helper->direct('foo', 'bar', true);
        $this->_checkRenderProperties();
    }

    public function testViewBasePathSpecDefault()
    {
        $this->assertEquals(':moduleDir/views', $this->helper->getViewBasePathSpec());
    }

    public function testSettingViewBasePathSpec()
    {
        $this->helper->setViewBasePathSpec(':moduleDir/views/:controller');
        $this->assertEquals(':moduleDir/views/:controller', $this->helper->getViewBasePathSpec());
    }

    public function testViewScriptPathSpecDefault()
    {
        $this->assertEquals(':controller/:action.:suffix', $this->helper->getViewScriptPathSpec());
    }

    public function testSettingViewScriptPathSpec()
    {
        $this->helper->setViewScriptPathSpec(':moduleDir/views/:controller');
        $this->assertEquals(':moduleDir/views/:controller', $this->helper->getViewScriptPathSpec());
    }

    public function testViewScriptPathNoControllerSpecDefault()
    {
        $this->assertEquals(':action.:suffix', $this->helper->getViewScriptPathNoControllerSpec());
    }

    public function testSettingViewScriptPathNoControllerSpec()
    {
        $this->helper->setViewScriptPathNoControllerSpec(':module/:action.:suffix');
        $this->assertEquals(':module/:action.:suffix', $this->helper->getViewScriptPathNoControllerSpec());
    }

    public function testGetViewScriptWithDefaults()
    {
        $this->request->setModuleName('bar')
                      ->setControllerName('index')
                      ->setActionName('test');
        $controller = new Bar_IndexController($this->request, $this->response, array());
        $expected   = 'index/test.phtml';
        $this->assertEquals($expected, $this->helper->getViewScript());
    }

    public function testGetViewScriptWithSpecifiedAction()
    {
        $this->request->setModuleName('bar')
                      ->setControllerName('index')
                      ->setActionName('test');
        $controller = new Bar_IndexController($this->request, $this->response, array());
        $expected   = 'index/baz.phtml';
        $this->assertEquals($expected, $this->helper->getViewScript('baz'));
    }

    public function testGetViewScriptWithSpecifiedVars()
    {
        $this->request->setModuleName('bar')
                      ->setControllerName('index')
                      ->setActionName('test');
        $controller = new Bar_IndexController($this->request, $this->response, array());
        $expected   = 'baz/bat.php';
        $this->assertEquals(
            $expected,
            $this->helper->getViewScript(
                null,
                array('controller' => 'baz', 'action' => 'bat', 'suffix' => 'php')
            )
        );
    }

    public function testGetViewScriptWithNoControllerSet()
    {
        $this->request->setModuleName('bar')
                      ->setControllerName('index')
                      ->setActionName('test');
        $controller = new Bar_IndexController($this->request, $this->response, array());
        $this->helper->setNoController();
        $expected   = 'test.phtml';
        $this->assertEquals($expected, $this->helper->getViewScript());
    }

    public function testRenderScript()
    {
        $this->request->setModuleName('bar')
                      ->setControllerName('index')
                      ->setActionName('test');
        $controller = new Bar_IndexController($this->request, $this->response, array());
        $this->helper->renderScript('index/test.phtml');
        $body = $this->response->getBody();
        $this->assertContains('Rendered index/test.phtml in bar module', $body);
    }

    public function testRenderScriptToNamedResponseSegment()
    {
        $this->request->setModuleName('bar')
                      ->setControllerName('index')
                      ->setActionName('test');
        $controller = new Bar_IndexController($this->request, $this->response, array());
        $this->helper->renderScript('index/test.phtml', 'foo');
        $body = $this->response->getBody('foo');
        $this->assertContains('Rendered index/test.phtml in bar module', $body);
    }

    public function testRenderScriptToPreviouslyNamedResponseSegment()
    {
        $this->request->setModuleName('bar')
                      ->setControllerName('index')
                      ->setActionName('test');
        $controller = new Bar_IndexController($this->request, $this->response, array());
        $this->helper->setResponseSegment('foo');
        $this->helper->renderScript('index/test.phtml');
        $body = $this->response->getBody('foo');
        $this->assertContains('Rendered index/test.phtml in bar module', $body);
    }

    public function testRenderWithDefaults()
    {
        $this->request->setModuleName('bar')
                      ->setControllerName('index')
                      ->setActionName('test');
        $controller = new Bar_IndexController($this->request, $this->response, array());
        $this->helper->render();
        $body = $this->response->getBody();
        $this->assertContains('Rendered index/test.phtml in bar module', $body);
    }

    public function testRenderToSpecifiedAction()
    {
        $this->request->setModuleName('bar')
                      ->setControllerName('index')
                      ->setActionName('index');
        $controller = new Bar_IndexController($this->request, $this->response, array());
        $this->helper->render('test');
        $body = $this->response->getBody();
        $this->assertContains('Rendered index/test.phtml in bar module', $body);
    }

    public function testRenderWithNoController()
    {
        $this->request->setModuleName('bar')
                      ->setControllerName('index')
                      ->setActionName('test');
        $controller = new Bar_IndexController($this->request, $this->response, array());
        $this->helper->render(null, null, true);
        $body = $this->response->getBody();
        $this->assertContains('Rendered test.phtml in bar module', $body);
    }

    public function testRenderToNamedSegment()
    {
        $this->request->setModuleName('bar')
                      ->setControllerName('index')
                      ->setActionName('test');
        $controller = new Bar_IndexController($this->request, $this->response, array());
        $this->helper->render(null, 'foo');
        $body = $this->response->getBody('foo');
        $this->assertContains('Rendered index/test.phtml in bar module', $body);
    }

    public function testRenderBySpec()
    {
        $this->request->setModuleName('bar')
                      ->setControllerName('index')
                      ->setActionName('index');
        $controller = new Bar_IndexController($this->request, $this->response, array());
        $this->helper->renderBySpec('foo', array('controller' => 'test', 'suffix' => 'php'));
        $body = $this->response->getBody();
        $this->assertContains('Rendered test/foo.php', $body);
    }

    public function testRenderBySpecToNamedResponseSegment()
    {
        $this->request->setModuleName('bar')
                      ->setControllerName('index')
                      ->setActionName('index');
        $controller = new Bar_IndexController($this->request, $this->response, array());
        $this->helper->renderBySpec('foo', array('controller' => 'test', 'suffix' => 'php'), 'foo');
        $body = $this->response->getBody('foo');
        $this->assertContains('Rendered test/foo.php', $body);
    }

    public function testInitDoesNotInitViewWhenNoViewRendererSet()
    {
        $this->request->setModuleName('bar')
                      ->setControllerName('index')
                      ->setActionName('index');
        $this->front->setParam('noViewRenderer', true);
        $controller = new Bar_IndexController($this->request, $this->response, array());
        $this->assertNull($controller->view);
    }

    public function testPostDispatchDoesNotRenderViewWhenNoViewRendererSet()
    {
        $this->request->setModuleName('bar')
                      ->setControllerName('index')
                      ->setActionName('index');
        $this->front->setParam('noViewRenderer', true);
        $controller = new Bar_IndexController($this->request, $this->response, array());
        $this->helper->postDispatch();
        $body = $this->response->getBody();
        $this->assertTrue(empty($body));
    }

    public function testRenderNormalizationIsCorrect()
    {
        $this->request->setModuleName('default')
                      ->setControllerName('foo')
                      ->setActionName('myBar');
        $controller = new Bar_IndexController($this->request, $this->response, array());
        $this->helper->setActionController($controller);
        $scriptName = $this->helper->getViewScript();
        $this->assertEquals('foo/my-bar.phtml', $scriptName);

        $this->request->setModuleName('default')
                      ->setControllerName('foo')
                      ->setActionName('baz__bat');
        $scriptName = $this->helper->getViewScript();
        $this->assertEquals('foo/baz-bat.phtml', $scriptName);

        $this->request->setModuleName('default')
                      ->setControllerName('Foo_Bar')
                      ->setActionName('bar__baz');
        $scriptName = $this->helper->getViewScript();
        $this->assertEquals('foo/bar/bar-baz.phtml', $scriptName);
    }

    public function testGetInflectorGetsDefaultInflectorWhenNoneProvided()
    {
        $inflector = $this->helper->getInflector();
        $this->assertTrue($inflector instanceof Zend_Filter_Inflector);
        $rules = $inflector->getRules();
        $this->assertTrue(isset($rules['module']));
        $this->assertTrue(isset($rules['moduleDir']));
        $this->assertTrue(isset($rules['controller']));
        $this->assertTrue(isset($rules['action']));
        $this->assertTrue(isset($rules['suffix']));
    }

    public function testInflectorAccessorsAllowSwappingInflectors()
    {
        $inflector = $this->helper->getInflector();
        $this->assertTrue($inflector instanceof Zend_Filter_Inflector);
        $newInflector = new Zend_Filter_Inflector();
        $this->helper->setInflector($newInflector);
        $receivedInflector = $this->helper->getInflector();
        $this->assertSame($newInflector, $receivedInflector);
        $this->assertNotSame($newInflector, $inflector);
    }

    public function testCustomInflectorCanUseItsOwnTarget()
    {
        $this->request->setModuleName('bar')
                      ->setControllerName('index')
                      ->setActionName('index');
        $controller = new Bar_IndexController($this->request, $this->response, array());

        $this->helper->view->addBasePath($this->basePath . '/_files/modules/bar/views');

        $inflector = new Zend_Filter_Inflector('test.phtml');
        $inflector->addFilterRule(':controller', array('Word_CamelCaseToDash'));
        $this->helper->setInflector($inflector);

        $this->helper->render();
        $body = $this->response->getBody();
        $this->assertContains('Rendered test.phtml in bar module', $body);
    }

    public function testCustomInflectorUsesViewRendererTargetWhenPassedInWithReferenceFlag()
    {
        $this->request->setModuleName('bar')
                      ->setControllerName('index')
                      ->setActionName('test');
        $controller = new Bar_IndexController($this->request, $this->response, array());

        $this->helper->view->addBasePath($this->basePath . '/_files/modules/bar/views');

        require_once 'Zend/Filter/PregReplace.php';
        require_once 'Zend/Filter/Word/UnderscoreToSeparator.php';

        $inflector = new Zend_Filter_Inflector('test.phtml');
        $inflector->addRules(array(
            ':module'     => array('Word_CamelCaseToDash', 'stringToLower'),
            ':controller' => array('Word_CamelCaseToDash', new Zend_Filter_Word_UnderscoreToSeparator(DIRECTORY_SEPARATOR), 'StringToLower'),
            ':action'     => array(
                'Word_CamelCaseToDash',
                new Zend_Filter_PregReplace('/[^a-z0-9]+/i', '-'),
                'StringToLower'
            ),
        ));
        $this->helper->setInflector($inflector, true);

        $this->helper->render();
        $body = $this->response->getBody();
        $this->assertContains('Rendered index/test.phtml in bar module', $body);
    }

    public function testStockInflectorAllowsSubDirectoryViewScripts()
    {
        $this->request->setModuleName('bar')
                      ->setControllerName('index')
                      ->setActionName('layout/admin');
        $this->assertEquals('index/layout/admin.phtml', $this->helper->getViewScript());
    }

    /**
     * @see ZF-2443
     */
    public function testStockInflectorWorksWithViewBaseSpec()
    {
        $this->request->setModuleName('bar')  // bar must exist so the ViewRendere doesnt throw an exception
                      ->setControllerName('index')
                      ->setActionName('admin');
        $controller = new Bar_IndexController($this->request, $this->response, array());
        $this->helper->setActionController($controller);

        $this->helper->setViewBasePathSpec(':moduleDir/:module');
        $this->helper->initView();

        $viewScriptPaths = $this->helper->view->getAllPaths();

        $expectedPathRegex = '#modules/bar/bar/scripts/$#';
        $this->assertRegExp(
            $expectedPathRegex,
            $this->_normalizePath($viewScriptPaths['script'][0])
            );
        $this->assertEquals($this->helper->getViewScript(), 'index/admin.phtml');
    }

    /**
     * @see ZF-2738
     */
    public function testStockInflectorWorksWithDottedRequestParts()
    {
        $this->request->setModuleName('foo')
                      ->setControllerName('car.bar')
                      ->setActionName('baz');
        $controller = new Bar_IndexController($this->request, $this->response, array());
        $this->helper->setActionController($controller);
        $viewScriptPaths = $this->helper->view->getAllPaths();

        $expectedPathRegex = '#modules/foo/views/scripts/$#';
        $this->assertRegExp(
            $expectedPathRegex,
            $this->_normalizePath($viewScriptPaths['script'][0])
            );
        $this->assertEquals('car-bar/baz.phtml', $this->helper->getViewScript());
    }

    public function testCorrectViewHelperPathShouldBePropagatedWhenSubControllerInvoked()
    {
        require_once $this->basePath . '/_files/modules/foo/controllers/Admin/IndexController.php';
        $this->request->setModuleName('foo')
                      ->setControllerName('admin_index')
                      ->setActionName('use-helper');
        $controller = new Foo_Admin_IndexController($this->request, $this->response, array());

        $this->helper->render();
        $body = $this->response->getBody();
        $this->assertContains('fooUseHelper invoked', $body, 'Received ' . $body);
    }
    /**
     * @group ZF-10725
     */
    public function testThatCharactersStrippedFromActionNameByDispatcherAreAlsoStrippedFromViewScriptName()
    {
        $this->request->setModuleName('default')
                      ->setControllerName('foo')
                      ->setActionName('-myBar-');
        $controller = new Bar_IndexController($this->request, $this->response, array());
        $this->helper->setActionController($controller);
        $scriptName = $this->helper->getViewScript();
        $this->assertEquals('foo/my-bar.phtml', $scriptName);
    }

    public function testCorrectViewHelperPathShouldBePropagatedWhenSubControllerInvokedInDefaultModule()
    {
        require_once $this->basePath . '/_files/modules/default/controllers/Admin/HelperController.php';
        $this->request->setControllerName('admin_helper')
                      ->setActionName('render');
        $controller = new Admin_HelperController($this->request, $this->response, array());

        $this->helper->render();
        $body = $this->response->getBody();
        $this->assertContains('SampleZfHelper invoked', $body, 'Received ' . $body);
    }

    /**
     * @group ZF-11127
     */
    public function testViewSuffixInstanceNotSharedWhenViewHelperIsCloned()
    {
        $a = new Zend_Controller_Action_Helper_ViewRenderer();
        $a->init();
        $a->setViewSuffix('A');

        $this->assertEquals('A', $a->getViewSuffix());

        $b = clone $a;
        $this->assertEquals('A', $b->getViewSuffix());
        $b->setViewSuffix('B');

        $this->assertEquals('B', $b->getViewSuffix());
        $this->assertNotEquals('B', $a->getViewSuffix());
    }

    /**
     * @group ZF-10725
     * @dataProvider providerViewScriptNameDoesNotIncludeDisallowedCharacters
     */
    public function testViewScriptNameDoesNotIncludeDisallowedCharacters($actionName)
    {
        $this->request->setModuleName('default')
                      ->setControllerName('foo')
                      ->setActionName($actionName);
        $controller = new Bar_IndexController($this->request, $this->response, array());
        $this->helper->setActionController($controller);
        $scriptName = $this->helper->getViewScript();
        $this->assertEquals('foo/my-bar.phtml', $scriptName);
    }

    /**
     * Data provider for testViewScriptNameDoesNotIncludeDisallowedCharacters
     * @group ZF-10725
     * @return array
     */
    public function providerViewScriptNameDoesNotIncludeDisallowedCharacters()
    {
        return array(
            array('myBar-'),
            array('-myBar'),
            array('-myBar-'),
            array('-MyBar-'),
            array('MyBar-'),
            array('-MyBar')
        );
    }

    protected function _normalizePath($path)
    {
        return str_replace(array('/', '\\'), '/', $path);
    }

    /**
     * @group ZF-10725
     */
    public function testActionsWithLeadingCapitalLettersShouldNotInvokeTruncatedViewScripts()
    {
        $this->request->setModuleName('default')
                      ->setControllerName('Controller')
                      ->setActionName('Action');
        $controller = new Bar_IndexController($this->request, $this->response, array());
        $this->helper->setActionController($controller);
        $scriptName = $this->helper->getViewScript();
        $this->assertEquals('controller/action.phtml', $scriptName);
    }
}

// Call Zend_Controller_Action_Helper_ViewRendererTest::main() if this source file is executed directly.
if (PHPUnit_MAIN_METHOD == "Zend_Controller_Action_Helper_ViewRendererTest::main") {
    Zend_Controller_Action_Helper_ViewRendererTest::main();
}


text:
using System;
using System.Linq;
using System.Text;
using System.Collections.Generic;

using Quasar.HabboHotel.Rooms;
using Quasar.HabboHotel.Items;
using Quasar.Communication.Packets.Outgoing.Inventory.Furni;

using Quasar.Communication.Packets.Outgoing.Rooms.Furni;

namespace Quasar.Communication.Packets.Incoming.Rooms.Furni
{
    class ExecuteCraftingRecipeEvent : IPacketEvent
    {
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            int craftingTable = Packet.PopInt();
            string recipeName = Packet.PopString();

            //Console.WriteLine("ID Mesa: " + craftingTable);
            //Console.WriteLine("Receta: " + recipeName);

            var recipe = QuasarEnvironment.GetGame().GetCraftingManager().GetRecipe(recipeName);

            if (recipe == null) return;
            ItemData resultItem = QuasarEnvironment.GetGame().GetItemManager().GetItemByName(recipe.Result);
            if (resultItem == null) return;
            bool success = true;
            foreach (var need in recipe.ItemsNeeded)
            {
                for (var i = 1; i <= need.Value; i++)
                {
                    ItemData item = QuasarEnvironment.GetGame().GetItemManager().GetItemByName(need.Key);
                    if (item == null)
                    {
                        success = false;
                        continue;
                    }
                    var inv = Session.GetHabbo().GetInventoryComponent().GetFirstItemByBaseId(item.Id);
                    if (inv == null)
                    {
                        success = false;
                        continue;
                    }
                    Session.GetHabbo().GetInventoryComponent().RemoveItem(inv.Id);
                }
            }
            if (success)
            {
                Session.GetHabbo().GetInventoryComponent().AddNewItem(0, resultItem.Id, "", 0, true, false, 0, 0);
                Session.SendMessage(new FurniListUpdateComposer());
            }
            Session.SendMessage(new CraftingResultComposer(recipe, success));
        }
    }
}


text:
require 'parseconfig'
require 'pathname'
require 'singleton'
require 'ocs/logging'
require 'ocs/settings/handler'
require 'ocs/settings/system/path'

module OCS
  module Settings
    class Loader

      include Singleton

      attr_reader :handler

      #
      #
      # @return [Nothing]
      def initialize
        @handler = load
      end

      #
      #
      # @return [OCS::Settings::Handler,nil] [description]
      def load
        begin
          # Parse user configuration
          @settings = ParseConfig.new(OCS::Settings::System::Path::OCS_SETTINGS_PATH)
        rescue Exception => e
          OCS::Logger.error "Failed to load settings at #{OCS::Settings::System::Path::OCS_SETTINGS_PATH}"
          OCS::Logger.error e.message
          OCS::Logger.error e.backtrace.inspect
          nil
        else
          # Return a OCS::Settings::Handler object (i.e., a convenient accessor object)
          # for the loaded settings.
          OCS::Settings::Handler.new(@settings)
        end
      end
      private :load

    end # class Loader
  end # module Settings
end # module OCS


text:
/// <reference path='fourslash.ts' />

//// function foo(lambda){}
//// foo(function /*x*/is/*y*/Even(n) {
////    return n % 2 === 0;
//// });

goTo.select("x", "y");
edit.applyRefactor({
    refactorName: "Convert arrow function or function expression",
    actionName: "Convert to arrow function",
    actionDescription: "Convert to arrow function",
    newContent: `function foo(lambda){}
foo((n) => n % 2 === 0);`,
});


text:
class Exploration(object):

    ADDITIVE_EXPLORATION, CONDITIONAL_EXPLORATION = range(2)

    def __init__(self, exp_type):
        self.exp_type = exp_type

    def explore(self, x):
        """
        Do operation on x and return new value
        """
        raise NotImplementedError


text:
package hudson.security;

import org.acegisecurity.ui.rememberme.RememberMeServices;
import org.acegisecurity.Authentication;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * {@link RememberMeServices} proxy.
 *
 *

 * In Hudson, we need {@link jenkins.model.Jenkins} instance to perform remember-me service,
 * because it relies on {@link jenkins.model.Jenkins#getSecretKey()}. However, security
 * filters can be initialized before Hudson is initialized.
 * (See #1210 for example.)
 *
 *

 * So to work around the problem, we use a proxy.
 *
 * @author Kohsuke Kawaguchi
 */
public class RememberMeServicesProxy implements RememberMeServices {
    private volatile RememberMeServices delegate;

    public Authentication autoLogin(HttpServletRequest request, HttpServletResponse response) {
        RememberMeServices d = delegate;
        if(d!=null)     return d.autoLogin(request,response);
        return null;
    }

    public void loginFail(HttpServletRequest request, HttpServletResponse response) {
        RememberMeServices d = delegate;
        if(d!=null)     d.loginFail(request,response);
    }

    public void loginSuccess(HttpServletRequest request, HttpServletResponse response, Authentication successfulAuthentication) {
        RememberMeServices d = delegate;
        if(d!=null)     d.loginSuccess(request,response,successfulAuthentication);
    }

    public void setDelegate(RememberMeServices delegate) {
        this.delegate = delegate;
    }
}


text:
export OUTDIR=/repo/tests/output
export ENV_REPO=${OUTDIR}/gitenv
export INSTALL_ROOT=/opt/conda

REPO_ROOT=$(cd "$(dirname ${0})/../../.."; pwd;)

# Test conda-gitenv approach.
cat << EOF | docker run -i \
                        -v ${REPO_ROOT}:/repo \
                        -a stdin -a stdout -a stderr \
                        centos:6 \
                        bash || exit ${?}

yum install -y rpm-build wget which tar
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh --no-verbose
bash Miniconda3-latest-Linux-x86_64.sh -b -p ${INSTALL_ROOT} && rm -f Miniconda*.sh
export PATH=${INSTALL_ROOT}/bin:\${PATH}

export PYTHONPATH=/repo/

rm -rf ${INSTALL_ROOT}/pkgs/
mkdir -p ${OUTDIR}/pkg_cache
ln -s ${OUTDIR}/pkg_cache /opt/conda/pkgs

conda install --yes -c conda-forge gitpython conda-build-all git

git config --global user.email "you@example.com"
git config --global user.name "Your Name"

git clone https://github.com/SciTools/conda-gitenv.git
cd conda-gitenv
python setup.py install
cd ..

mkdir -p ${OUTDIR} ${ENV_REPO}
cd ${ENV_REPO}
git init
cat <<SPEC_EOF > env.spec
channels:
 - defaults
env:
 - python

SPEC_EOF

git add env.spec
git commit -m "Added the default environment."
git branch -m default

conda-gitenv resolve ${OUTDIR}/gitenv
conda-gitenv autotag ${OUTDIR}/gitenv

# Label the resolved tag
ENV_TAG=\$(cd ${OUTDIR}/gitenv; git tag -l | grep default | head -n 1)
echo "ENV TAG: \${ENV_TAG}"
git checkout default
mkdir -p labels
echo \${ENV_TAG} > labels/current.txt
git add labels/current.txt
git commit -m "Added the current label to the default environment."

cat <<CONFIG_EOF > /repo/conda_rpms/config.yaml
rpm:
    prefix: 'TestMyBuild'

install:
    prefix: '/opt/testmybuild'

CONFIG_EOF

python /repo/conda_rpms/build_rpm_structure.py ${OUTDIR}/gitenv ${OUTDIR}/gitenv_rpmbuild -c /repo/conda_rpms/config.yaml

test -f ${OUTDIR}/gitenv_rpmbuild/SPECS/TestMyBuild-installer.spec

EOF


text:
ircmessage
==========

ircmessage provides a scanner capable of parsing RFC1459-compliant IRC messages, with support for IRCv3 message tags.

Based on the node module: https://github.com/sigkell/irc-message

Documentation: https://godoc.org/github.com/bruston/ircmessage


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="icon" HREF="favicon.ico">
    <title>vis.js - Edges documentation.</title>

    <link href="../css/bootstrap.css" rel="stylesheet">
    <link href="../css/style.css" rel="stylesheet">

    <link href="../css/prettify.css" type="text/css" rel="stylesheet"/>

                    <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar"
                            aria-expanded="false" aria-controls="navbar">
                        Toggle navigation

                    </button>
                    vis.js

Modules

Blog

Download

Showcase

Contribute

Feature requests

License

Network - edges

Handles the creation and deletion of edges and contains the global edge options and styles.

    Back to overview.

Options

The options for the edges have to be contained in an object titled 'edges'. All of these options can be supplied per edge as well. Obviously, 'id' should not be defined globally but per edge. Options defined
    in the global edges object, are applied to all edges. If an edge has options of its own, those will be used instead of the global options.

When you have given an edge an option, you will override the global option for that property. If you then set that option to null,
        it will revert back to the default value.

Click on the full options or shorthand options to show how these options are supposed to be used.

options hidden

full options

shorthand options

// these are all options in full.
var options = {
  edges:{
    arrows: {
      to:     {enabled: false, scaleFactor:1},
      middle: {enabled: false, scaleFactor:1},
      from:   {enabled: false, scaleFactor:1}
    },
    color: {
      color:'#848484',
      highlight:'#848484',
      hover: '#848484',
      inherit: 'from',
      opacity:1.0
    },
    dashes: false,
    font: {
      color: '#343434',
      size: 14, // px
      face: 'arial',
      background: 'none',
      strokeWidth: 2, // px
      strokeColor: '#ffffff',
      align:'horizontal'
    },
    hidden: false,
    hoverWidth: 1.5,
    label: undefined,
    length: undefined,
    physics: true,
    scaling:{
      min: 1,
      max: 15,
      label: {
        enabled: true,
        min: 14,
        max: 30,
        maxVisible: 30,
        drawThreshold: 5
      },
      customScalingFunction: function (min,max,total,value) {
        if (max === min) {
          return 0.5;
        }
        else {
          var scale = 1 / (max - min);
          return Math.max(0,(value - min)*scale);
        }
      }
    },
    selectionWidth: 1,
    selfReferenceSize:20,
    shadow:{
      enabled: false,
      size:10,
      x:5,
      y:5
    },
    smooth: {
      enabled: true,
      type: "dynamic",
      roundness: 0.5
    },
    title:undefined,
    width: 1,
    value: undefined
  }
}

network.setOptions(options);

// here all options that have shorthand notations are shown.
var options = {
  edges:{
    arrows: 'to, from',
    color: 'red',
    font: '12px arial #ff0000',
    scaling:{
      label: true,
    },
    shadow: true,
    smooth: true,
  }
}

network.setOptions(options);

These options can also be set per individual edge.

            Name
            Type
            Default
            Description

             arrows
            Object or String
            undefined
            To draw an arrow with default settings a string can be supplied. For example: arrows:'to, from,
                middle' or 'to;from', any combination with any seperating symbol is fine. If you
                want to control the size of the arrowheads, you can supply an object.

            arrows.to
            Object or Boolean
            Object
            When true, an arrowhead on the 'to' side of the edge is drawn, pointing to the 'to' node with default
                settings. To customize the size of the arrow, supply an object.

            arrows.to.enabled
            Boolean
            false
            Toggle the arrow on or off. This option is optional, if undefined and the scaleFactor property is set,
                enabled will be set to true.

            arrows.to.scaleFactor
            Number
            1
            The scale factor allows you to change the size of the arrowhead.

            arrows.middle
            Object or Boolean
            Object
            Exactly the same as the to object but with an arrowhead in the center of the edge.

            arrows.from
            Object or Boolean
            Object
            Exactly the same as the to object but with an arrowhead at the from node of the edge.

             color
            Object or String
            Object
            The color object contains the color information of the edge in every situation. When the edge only needs
                a single color, a color value like 'rgb(120,32,14)', '#ffffff' or
                'red' can be supplied instead of an object.

            color.color
            String
            '#848484'
            The color of the border of the node when it is not selected or hovered over (assuming hover is
                enabled in the interaction module).

            color.highlight
            String
            '#848484'
            The color the edge when it is selected.

            color.hover
            String
            '#848484'
            The color the edge when the mouse hovers over it (assuming hover is enabled in the interaction
                module).

            color.inherit
            String or Boolean
            'from'
            When color, highlight or hover are defined, inherit is set to false!

Supported options are: true, false, 'from','to','both'.

The default value is 'from' which does the same as true: the edge will inherit the color from
                the border of the node on the 'from' side.

When set to 'to', the border color from the 'to' node will be used.

When set to 'both', the color will fade from the from color to the to color. 'both' is
                    computationally intensive because the gradient is recomputed every redraw. This is required
                because the angles change when the nodes move.

            color.opacity
            Number
            1.0
            It can be useful to set the opacity of an edge without manually changing all the colors. The opacity
                option will convert all colors (also when using inherit) to adhere to the supplied opacity. The allowed
                range of the opacity option is between 0 and 1. This is only done once so the performance
                impact is not too big.

            dashes
            Array or Boolean
            false
            When true, the edge will be drawn as a dashed line. You can customize the dashes by supplying an Array.
                Array formart: Array of numbers, gap length, dash length, gap length, dash length, ... etc. The array is
                repeated until the distance is filled.
                When using dashed lines in IE versions older than 11, the line will be drawn straight, not smooth.

             font
            Object or String
            false
            This object defines the details of the label. A shorthand is also supported in the form 'size face
                color' for example: '14px arial red'.

            font.color
            String
            '#343434'
            Color of the label text.

            font.size
            Number
            14
            Size of the label text.

            font.face
            String
            'arial'
            Font face (or font family) of the label text.

            font.background
            String
            undefined
            When not undefined but a color string, a background rectangle will be drawn behind
                the label in the supplied color.

            font.strokeWidth
            Number
            2
            As an alternative to the background rectangle, a stroke can be drawn around the text. When a value
                higher than 0 is supplied, the stroke will be drawn.

            font.strokeColor
            String
            '#ffffff'
            This is the color of the stroke assuming the value for stroke is higher than 0.

            font.align
            String
            'horizontal'
            Possible options: 'horizontal','top','middle','bottom'. The alignment determines how the
                label is aligned over the edge. The default value horizontal aligns the label horizontally,
                regardless of the orientation of the edge. When an option other than horizontal is chosen,
                the label will align itself according to the edge.

            from
            Number or String

            Edges are between two nodes, one to and one from. This is where you define the from node. You have to supply the corresponding node ID. This naturally only applies to individual edges.

            hidden
            Boolean
            false
            When true, the edge is not drawn. It is part still part of the physics simulation however!

            hoverWidth
            Number or Function
            0.5
            Assuming the hover behaviour is enabled in the interaction module, the
                hoverWidth determines the width of the edge when the user hovers over it with the mouse. If a number is
                supplied, this number will be added to the width.
                Because the width can be altered by the value and the scaling functions, a constant multiplier or added
                value may not give the best results. To solve this, you can supply a function. Example:

var options: {
  edges: {
    hoverWidth: function (width) {return width+1;}
  }
}

                It receives the Number width of the edge. In this simple example we add 1 to the width. You
                can taylor the logic in the function as long as it returns a Number.

            id
            String
            undefined
            The id of the edge. The id is optional for edges. When not supplied, an UUID will be assigned to the edge. This naturally only applies to individual edges.

            label
            String
            undefined
            The label of the edge. HTML does not work in here because the network uses HTML5 Canvas.

            length
            Number
            undefined
            The physics simulation gives edges a spring length. This value can override the length of the spring in
                rest.

            physics
            Boolean
            true
            When true, the edge is part of the physics simulation. When false, it will not act as a spring.

             scaling
            Object
            Object
            If the value option is specified, the width of the edges will be scaled according to the
                properties in this object. Keep in mind that when using scaling, the width option is
                neglected.

            scaling.min
            Number
            1
            If edges have a value, their widths are determined by the value, the scaling function and the min max
                values. The min value is the minimum allowed value.

            scaling.max
            Number
            15
            This is the maximum allowed width when the edges are scaled using the value option.

            scaling.label
            Object or Boolean
            Object
            When false, the label is not allowed to scale with the edge. If true it will scale using default
                settigns. For further customization, you can supply an object.

            scaling.label.enabled
            Boolean
            false
            Toggle the scaling of the label on or off. If this option is not defined, it is set to true if any of
                the properties in this object are defined.

            scaling.label.min
            Number
            14
            The minimum font-size used for labels when scaling.

            scaling.label.max
            Number
            30
            The maximum font-size used for labels when scaling.

            scaling.label.maxVisible
            Number
            30
            When zooming in, the font is drawn larger as well. You can limit the perceived font size using this
                option. If set to 30, the font will never look larger than size 30 zoomed at 100%.

            scaling.label.drawThreshold
            Number
            5
            When zooming out, the font will be drawn smaller. This defines a lower limit for when the font is drawn.
                When using font scaling, you can use this together with the maxVisible to first show labels of important
                edges when zoomed out and only show the rest when zooming in.

            scaling.customScalingFunction
            Function
            in description
            If edges have value fields, this function determines how the size of the nodes are scaled
                based on their values. The default function is:

function (min,max,total,value) {
  if (max === min) {
    return 0.5;
  }
  else {
    var scale = 1 / (max - min);
    return Math.max(0,(value - min)*scale);
  }
}

                The function receives the minimum value of the set, the maximum value, the total sum of all values and
                finally the value of the node or edge it works on. It has to return a value between 0 and 1. The
                nodes and edges then calculate their size as follows:

var scale = customScalingFunction(min,max,total,value);
var diff = maxWidth - minWidth;
myWidth = minWidth + diff * scale;

            selectionWidth
            Number or Function
            1
            The selectionWidth determines the width of the edge when the edge is selected. If a number is supplied,
                this number will be added to the width.
                Because the width can be altered by the value and the scaling functions, a constant multiplier or added
                value may not give the best results. To solve this, you can supply a function. Example:

var options: {
  edges: {
    selectionWidth: function (width) {return width*2;}
  }
}

                It receives the Number width of the edge. In this simple example multiply the width by 2.
                You can taylor the logic in the function as long as it returns a Number.

            selfReferenceSize
            Number
            false
            When the to and from nodes are the same, a circle is drawn. This is the radius of that circle.

             shadow
            Object or Boolean
            Object
            When true, the edge casts a shadow using the default settings. This can be further refined by supplying
                an object.

            shadow.enabled
            Boolean
            false
            Toggle the casting of shadows. If this option is not defined, it is set to true if any of the properties
                in this object are defined.

            shadow.size
            Number
            10
            The blur size of the shadow.

            shadow.x
            Number
            5
            The x offset.

            shadow.y
            Number
            5
            The y offset.

             smooth
            Object or Boolean
            Object
            When true, the edge is drawn as a dynamic quadratic bezier curve. The drawing of these curves takes longer than
                that of straight curves but it looks better.
                There is a difference between dynamic smooth curves and static smooth curves. The dynamic smooth curves
                have an invisible support node that takes part in the physics simulation. If you have a lot of edges,
                you may want to consider picking a different type of smooth curves then dynamic for better performance.

            smooth.enabled
            Boolean
            true
            Toggle smooth curves on and off. This is an optional option. If any of the other properties in this
                object are set, this option will be set to true.

            smooth.type
            String
            'dynamic'
            Possible options: 'dynamic', 'continuous', 'discrete', 'diagonalCross', 'straightCross', 'horizontal',
                'vertical', 'curvedCW', 'curvedCCW'. Take a look at our example 26 to see what these look like
                and pick the one that you like best!

                When using dynamic, the edges will have an invisible support node guiding the shape. This node is part of the
                physics simulation.

            smooth.roundness
            Number
            0.5
            Accepted range: 0 .. 1.0. This parameter tweaks the roundness of the smooth curves for all types EXCEPT dynamic.

            title
            String
            undefined
            The title is shown in a pop-up when the mouse moves over the edge.

            to
            Number or String

            Edges are between two nodes, one to and one from. This is where you define the to node. You have to supply the corresponding node ID. This naturally only applies to individual edges.

            value
            Number
            undefined
            When a value is set, the edges' width will be scaled using the options in the scaling object defined
                above.

            width
            Number
            1
            The width of the edge. If value is set, this is not used.


text:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="bc.css">

Forge DevCon in Las Vegas

My plans changed. For the first time since 2005, I will not be visiting Las Vegas this year after all.

The most important participants in the Revit API session that I was preparing to host are the members of the Revit development team, anyway.

I very strongly urge you to not miss the chance to attend both AU and the preceding Forge developer conference, though, for all the reasons already pointed out in the article
on the Forge DevCon at AU in Darmstadt and Las Vegas.

Here is the latest news to provide that final kick, plus a very few pictures I took during the Forge accelerator last week in Lyon, France:

Dawn in Lyon

Forge DevCon highlights and reasons to join your peers

Sneak peek at the Forge DevCon keynotes

Visit the exclusive Forge DevCon village on Monday

Get one on one with Amazon Web Services

Decide now

Dawn in Lyon

Before diving into the current news on the Forge DevCon, here are a handful of pictures of dawn from the hotel window and the train station of Part Dieu in Lyon:

Forge DevCon Highlights and Reasons to Join your Peers

Join over a thousand developers already working with the Forge platform and committed to accelerating their businesses and careers.

You won't want to miss the last opportunity this year to get started with or delve deeper into Forge.

Hundreds of new developers are now engaging with Forge after the recent Forge DevCon conferences in China, Japan, Germany and most recently AU Russia.

Don't get left behind.

There won't be another opportunity like this until late 2018.

Register today for DevCon 2017!

Customers are embracing the cloud and they need applications and services to extend their Autodesk solutions. But don't just take our word for it.  You'll find the cloud everywhere at AU this year. In fact, searching the class catalogue the word 'cloud' produces 168 results:

AU class catalogue search for 'cloud'

Although you can learn some things by attending webinars, watching videos, reading blogs or using forums, it's just not the same as the benefits you gain from a face to face event.

Beyond the 50+ Forge classes, here are a few more reasons to seriously consider purchasing your Forge DevCon or combined DevCon and AU Pass today:

Sneak Peek at the Forge DevCon Keynotes

Be inspired by and learn from a great line-up of keynote speakers, including:

Jim Quanci,  Senior Director ADN and Forge Partner Development

Duleesha Kulasooriya, Head of Strategy and Research, Deloitte Center for the Edge

Brian Roepke, Senior Director, Forge Product Management

Scott Reese, Autodesk SVP of Construction and Manufacturing

Brian Mathews, Autodesk VP of Cloud Platforms

Autodesk Partners LimbForge and SmartVid.io

You don't want to miss the inspiring and illuminating topics including:

The big picture – where Forge is today, where it's going in the coming year and beyond

The manufacturing landscape of the future and why cloud products are the keys to the industry's democratization

Forge applied to Construction and BIM 360

Fireside chat on the vision of where Forge is headed and how this will create a competitive advantage for Autodesk partners and customers

... and more

Check out the in-depth information about
the Forge DevCon keynotes online.

Visit the exclusive Forge DevCon Village on Monday

The Village is an area that offers a mix of activities – exhibits, Forge Answer Bar and space to network. Talk to Forge early adopters and certified systems integrators about how easy it is to build Forge-based workflows. Come to the Forge Answer Bar and get questions answered by a team of Forge technical experts. See the research and startup projects Universities from around the world are doing with Forge. And be sure to drop by the Forge Reality Playground to learn how Forge can help you create immersive virtual and augmented reality experiences.

Learn more about
the Forge Village and Forge Partners.

Get One on One with Amazon Web Services

Amazon Web Services is the official cloud sponsor for Forge DevCon. The AWS teams will be hanging out at Forge DevCon and Autodesk University ready to answer your questions about moving to the cloud and taking advantage of cloud services.  Tom 'Elvis' Jones, Solutions Architect with AWS, will be teaching two classes, and the team will be in the DevCon Village and on the AU show floor.

Don't hesitate. Make your decision to be part of the future and join your peers already enjoying success with Forge (see some of them featured on the Forge website)
highlighting Forge in action – community using Forge to make the future.

Decide Now

Still on the fence?

We urge you to review the further reasons to attend highlighted in these previous articles:

Building desktop solutions?

Forge DevCon is not just for programmers

Register today for DevCon 2017!


text:
enum EDirect3DResourceType
{
	eDRT_Texture2D = 0,
	eDRT_TextureCUBE,
	eDRT_TextureVolume,

	eDRT_Surface,
	eDRT_Volume,

	eDRT_VertexBuffer,
	eDRT_IndexBuffer,

	eDRT_VertexDeclaration,

	eDRT_VertexShader,
	eDRT_PixelShader,

	eDRT_Count,
};

struct xDirect3DResourceBase
{
	xDirect3DResourceBase(EDirect3DResourceType type, res_index xResIndex, res_index d3dIndex):m_type(type), m_resIndex(xResIndex), m_d3dIndex(d3dIndex) { AddResource(m_resIndex, m_d3dIndex);}
	virtual ~xDirect3DResourceBase() { DeleteResource(m_resIndex, m_d3dIndex);}

	void AddResource( res_index xRes, res_index d3dRes );
	void DeleteResource( res_index xRes, res_index d3dRes  );

	EDirect3DResourceType m_type;
	res_index m_resIndex;
	res_index m_d3dIndex;
};

typedef std::map<res_index, res_index> xResourceLib;
typedef std::vector<xModel> xModelLib;
typedef std::vector<xDirect3DTexture9*> xTextureArray;

struct xDirect3DResourceManager
{
	xDirect3DTexture9*					getXTexMapping( res_index index );
	xDirect3DVertexBuffer9*				getXVBMapping( res_index index );
	xDirect3DVertexShader9*				getXVSMapping( res_index index );
	xDirect3DPixelShader9*				getXPSMapping( res_index index );
	xDirect3DVertexDeclaration9*		getXVCMapping( res_index index );
	xDirect3DSurface9*					getXSurfaceMapping( res_index index );
	xDirect3DVolume9*					getXVolumeMapping( res_index index );

	IDirect3DTexture9*					getD3DTexMapping( res_index index );
	IDirect3DVertexBuffer9*				getD3DVBMapping( res_index index );
	IDirect3DVertexShader9*				getD3DVSMapping( res_index index );
	IDirect3DPixelShader9*				getD3DPSMapping( res_index index );
	IDirect3DVertexDeclaration9*		getD3DVCMapping( res_index index );
	IDirect3DSurface9*					getD3DSurfaceMapping( res_index index );

	xDirect3DTexture9*					getXTexByIndex( uint32 index);
	xDirect3DVertexBuffer9*				getXVBByIndex( uint32 index );

	xDirect3DTexture9*					getTexAllByIndex( uint32 index);
	xDirect3DTexture9*					getTexRTByIndex( uint32 index);
	xDirect3DTexture9*					getTexGeneralByIndex( uint32 index);

	uint32								getTexAllCount() {return m_texAll.size();}
	uint32								getTexRTCount() {return m_texRenderTarget.size();}
	uint32								getTexGeneralCount() {return m_texGeneral.size();}

	xModel*								getModelByIndex( uint32 index );
	xModel&								addModel( xModel& model );

	void								removeModelWithVB( xDirect3DVertexBuffer9* vb );
	void								removeModelWithIB( xDirect3DIndexBuffer9* ib );

	uint32								getModelCount();
	uint32								getTexCount();
	float								getTexMemUsage();
	float								getTexVMemUsage();

	float								getVBMemUsage();
	float								getVBVMemUsage();

	void								cleanAllMapping();
	void								reCalcMemUsage();

	void SortTexArray( xTextureArray &thisList );

	xResourceLib m_resLibs[eDRT_Count];
	xResourceLib m_resReflect[eDRT_Count];

	xTextureArray m_texAll;
	xTextureArray m_texGeneral;
	xTextureArray m_texRenderTarget;

	xModelLib m_models;

	float m_texMemUsage;
	float m_texMemUsageGPU;
	float m_vbMemUsage;
	float m_vbMemUsageGPU;
};

#endif // xDirect3DResourceBase_h__