text:
hljs.initHighlightingOnLoad();

var emoji = window.emojiParser;

var highlight = function(highlightPromises, jqobj, addstylus) {
    highlightPromises.push(new Promise(function(resolve, reject) {
        try {
            if (addstylus) {
                jqobj.addClass('stylus');
            }
            var text = jqobj.text();
            if (text.indexOf('://') != -1) {
                console.log('skip on hljs freeze word');
                console.log(text);
                return resolve();
            }
            var result = hljs.highlightAuto(text);
            jqobj.html(result.value);
            return resolve();
        } catch (err) {
            console.err(err);
            return reject(err);
        }
    }));
}

/**
 * コードハイライト
 * @return Promise
 */
var codeHighlight = function(block) {
    var highlightPromises = [];
    block.find('pre code').not('.lang-math').each(function(i, block) {
        highlight(highlightPromises, $(this));
    });
    block.find('p code').not('.lang-math').each(function(i, block) {
        highlight(highlightPromises, $(this), true);
    });
    block.find('li code').not('.lang-math').each(function(i, block) {
        highlight(highlightPromises, $(this), true);
    });
    return Promise.all(highlightPromises);
};

/**
 * 数式をMathJaxを使って表示する処理
 * @return Promise
 */
var processMathJax = function(target) {
    return new Promise(function(resolve, reject) {
        // call MathJax
        MathJax.Hub.Queue(function() {
            MathJax.Hub.Typeset(target);
            return resolve();
        });
    });
};

/**
 * 内部の別の記事へのリンクを生成
 * @return Promise
 */
var processLink = function(parent) {
    return new Promise(function(resolve, reject) {
        if (parent) {
            var jqObj = parent;
            if (isString(parent)) {
                jqObj = $(parent);
            }
            target = jqObj.find('.internallink');
        } else {
            target = $('.internallink');
        }
        target.each(function(i, block) {
            var knowledgeNo = $(this).text().substring(1);
            console.log(knowledgeNo);
            var link = '';
            link += '#' + knowledgeNo;
            link += '';
            $(this).html(link);
        });
        return resolve();
    });
};

/**
 * 1つのブロックの装飾処理
 * @return Promise
 */
var decoration = function(jqObj) {
//    console.log(jqObj);
    return new Promise(function(resolve, reject) {
        return codeHighlight(jqObj)
        .then(function() {
            var content = emoji(jqObj.html().trim(), _CONTEXT + '/bower/emoji-parser/emoji', {classes: 'emoji-img'});
            jqObj.html(content);
            return Promise.resolve();
        }).then(function () {
            jqObj.find('a.oembed').oembed();
            return Promise.resolve();
        }).then(function () {
            // call slide.js
            showSlide(jqObj);
            return Promise.resolve();
        }).then(function () {
            // call parse internal link
            return processLink(jqObj);
        }).then(function() {
            // issue 711 脚注記法を正しく処理
            jqObj.find('a').each(function() {
                if ($(this).attr("href").startsWith('#fn')) {
                    var href= $(this).attr("href");
                    var target = $(href == "#" || href == "" ? 'html' : href);
                    var position = target.offset().top;
                    console.log(position);
                    // ヘッダーの分だけずらす
                    position -= 80;
                    var link = location.pathname + $(this).attr("href");
                    $(this).attr("href", link);
                    $(this).click(function() {
                        var speed = 400;
                        console.log(position);
                        $('body,html').animate({scrollTop:position}, speed, 'swing');
                        return false;
                    });
                }
            });
        }).then(function () {
            return resolve();
        }).catch(function(err) {
            console.error(err);
            return reject(err);
        });
    });
};

/**
 * 装飾処理
 * @return Promise
 */
var processDecoration = function(target) {
    if (isString(target)) {
        target = $(target);
    }
    var promises = [];
    target.each(function(index, element){
        var jqObj = $(element);
        promises.push(decoration(jqObj));
    });
    return Promise.all(promises);
};

var doPreview = function(titleId, contentId, previewAreaId, titleAreaId) {
    return parseMarkdown($(titleId).val(), $(contentId).val(), previewAreaId, titleAreaId);
};
/**
 * Markdownを処理してプレビューを表示
 * @return Promise
 */
var parseMarkdown = function(title, content, previewAreaId, titleAreaId) {
    return new Promise(function(resolve, reject) {
        $.post(_CONTEXT + '/open.knowledge/marked', {
            title : title,
            content : content
        }, function(data) {
            if (titleAreaId) {
                $(titleAreaId).html(data.title);
            }
            var html = '
';
            var content = data.content;
            html += content;
            html += '
';

            var jqObj = $(previewAreaId);
            jqObj.html(html);
            return processDecoration(previewAreaId).then(function() {
                return resolve();
            });
        });
    });
};

var removeAddedFile = function(fileNo) {
    var url = _CONTEXT + '/protect.file/delete/' + fileNo;
    $.ajax({
        type : 'DELETE',
        url : url,
        success : function(data, dataType) {
            $.notify(_REMOVE_FILE, 'info');
            $('#file-' + fileNo).remove();
        },
        error: function(XMLHttpRequest, textStatus, errorThrown){
            $.notify(_FAIL_REMOVE_FILE, 'warn');
        }
    });
};


text:
package com.google.teampot.servlet.task;

import java.io.IOException;
import java.util.logging.Logger;

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

import com.google.teampot.model.User;
import com.google.teampot.service.UserService;

public class ProvisionUserProfileServlet extends HttpServlet {

	private static final long serialVersionUID = 1L;

	private static final Logger logger = Logger.getLogger(ProvisionUserProfileServlet.class.getSimpleName());

	@Override
    public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
		String userKey = req.getParameter("user");
		User user = UserService.getInstance().get(userKey);
		UserService.getInstance().provisionProfile(user);
	}

}

redpajama_set_name: RedPajamaGithub


text:
c_hs Transformer
Lets make one for C FFI generation. 1. Write module header, pass file handle around.
2. Run language c quote and template haskell at each quoter occurrence. 3. Close file.
---

&initHs& = do
  h <- openFile "HSAux.hs" WriteMode
  hPutStrLn h "module HSAux where\n"
  return h

&closeHs& = hClose

&emit& :: (FormatString a) => Handle -> SrcLoc -> FCall a
     -> IO (Handle, C.Initializer)
&emit& h loc (FCall fname ffi_name args) = do
    let carg_list = map snd args
        cexpr = C.*FnCall* (C.Var (C.Id ffi_name loc) loc)
                      (map (flip C.Var loc) carg_list) loc
    hs_expr <- *runQ* $ mkHsExpr ffi_name fname args

    hPutStrLn h $ pprint hs_expr
    return (h, [cinit|$cexpr|])


text:
import os
import redis
from urlparse import urlparse
from bottle import route, run, response, abort

redisUrl = urlparse(os.environ['REDISTOGO_URL'])
pool = redis.ConnectionPool(host=redisUrl.hostname, port=redisUrl.port, db=0, password=redisUrl.password)

@route('/quote/<author>')
def get_quote(author):
    redisClient = redis.Redis(connection_pool=pool)
    redisKey = 'quote:' + author
    result = redisClient.srandmember(redisKey)
    response.content_type = 'application/json'
    if result:
        return result
    else:
        abort(404)

run(host='localhost', port=8080, debug=False)


text:
Ti.UI.setBackgroundColor('#FFF');
isAndroid = Ti.Platform.osname == 'android';
isIPad = Ti.Platform.osname == 'ipad';
isIPhone = Ti.Platform.osname == 'iphone';
isMobileweb = Ti.Platform.osname == 'mobileweb';

Ti.include('/lib/nrequire.js');

Cloud = require('ti.cloud');

nrequire("/initializers/config");
nrequire("/initializers/init").init();


text:
"""
Support Mi ACpartner IR.

Thank rytilahti for his great work
"""
import logging
from datetime import timedelta
import asyncio
from random import randint
import voluptuous as vol

import homeassistant.loader as loader
from homeassistant.components.switch import (SwitchDevice, PLATFORM_SCHEMA)
from homeassistant.const import (CONF_SWITCHES,
                                 CONF_COMMAND_OFF, CONF_COMMAND_ON,
                                 CONF_TIMEOUT, CONF_HOST, CONF_TOKEN,
                                 CONF_TYPE, CONF_NAME)
import homeassistant.helpers.config_validation as cv
from homeassistant.util.dt import utcnow

REQUIREMENTS = ['python-miio==0.0.11']

_LOGGER = logging.getLogger(__name__)

DEVICE_DEFAULT_NAME = 'mi_acpartner_ir'
SWITCH_DEFAULT_NAME = 'mi_acpartner_ir_switch'
DOMAIN = "mi_acpartner_ir"
DEFAULT_TIMEOUT = 30
DEFAULT_RETRY = 3
SERVICE_LEARN = "learn_command"
SERVICE_SEND = "send_packet"

SWITCH_SCHEMA = vol.Schema({
    vol.Optional(CONF_COMMAND_OFF, default=None): cv.string,
    vol.Optional(CONF_COMMAND_ON, default=None): cv.string,
    vol.Optional(CONF_NAME, default=SWITCH_DEFAULT_NAME): cv.string,
})

PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
    vol.Optional(CONF_SWITCHES, default={}):
        vol.Schema({cv.slug: SWITCH_SCHEMA}),
    vol.Required(CONF_HOST): cv.string,
    vol.Required(CONF_TOKEN): cv.string,
    vol.Optional(CONF_NAME, default=DEVICE_DEFAULT_NAME): cv.string,
    vol.Optional(CONF_TIMEOUT, default=DEFAULT_TIMEOUT): cv.positive_int
})

# pylint: disable=unused-argument
def setup_platform(hass, config, add_devices, discovery_info=None):
    """Set up the smart mi fan platform."""
    import miio
    host = config.get(CONF_HOST)
    name = config.get(CONF_NAME)
    token = config.get(CONF_TOKEN)
    devices = config.get(CONF_SWITCHES, {})
    persistent_notification = loader.get_component('persistent_notification')

    @asyncio.coroutine
    def _learn_command(call):
        ir_remote = miio.device(host, token)
        if not ir_remote:
            _LOGGER.error("Failed to connect to device.")
            return

        # key = randint(1,1000000)

        ir_remote.send('start_ir_learn', [30])

        _LOGGER.info("Press the key you want HASS to learn")
        start_time = utcnow()
        while (utcnow() - start_time) < timedelta(seconds=DEFAULT_TIMEOUT):
            code = ir_remote.send('get_ir_learn_result', [])
            if code[0] != '(null)':
                log_msg = 'Recieved packet is: %s' % code[0]
                _LOGGER.info(log_msg)
                persistent_notification.async_create(hass, log_msg,
                                                     title='Mi_ACpartner switch')
                ir_remote.send('end_ir_learn', [30])
                return
            yield from asyncio.sleep(1, loop=hass.loop)
        _LOGGER.error('Did not received any signal.')
        persistent_notification.async_create(hass,
                                             "Did not received any signal",
                                             title='Mi_ACpartner switch')

    @asyncio.coroutine
    def _send_packet(call):
        ir_remote = miio.device(host, token)
        if not ir_remote:
            _LOGGER.error("Failed to connect to device.")
            return

        packets = call.data.get('packet', [])
        for packet in packets:
            for retry in range(DEFAULT_RETRY):
                try:
                    ir_remote.send('send_ir_code', [str(packet)])
                    break
                except ValueError:
                    _LOGGER.error("Failed to send packet to device.")

    ir_remote = miio.device(host, token)
    if not ir_remote:
        _LOGGER.error("Failed to connect to device.")

    hass.services.register(DOMAIN, SERVICE_LEARN + '_' +
                            host.replace('.', '_'), _learn_command)
    hass.services.register(DOMAIN, SERVICE_SEND + '_' +
                            host.replace('.', '_'), _send_packet)
    switches = []
    for object_id, device_config in devices.items():
        switches.append(
            ChuangmiIRSwitch(
                ir_remote,
                device_config.get(CONF_NAME, object_id),
                device_config.get(CONF_COMMAND_ON),
                device_config.get(CONF_COMMAND_OFF),
                'mdi:volume-high'
            )
        )

    add_devices(switches)

class ChuangmiIRSwitch(SwitchDevice):
    """Representation of an Chuangmi switch."""

    def __init__(self, device, name, command_on, command_off, icon):
        """Initialize the switch."""
        self._name = name
        self._state = False
        self._command_on = command_on or None
        self._command_off = command_off or None
        self._device = device
        self._icon = icon

    @property
    def icon(self):
        """Return the icon to use for device if any."""
        return self._icon

    @property
    def name(self):
        """Return the name of the switch."""
        return self._name

    @property
    def assumed_state(self):
        """Return true if unable to access real state of entity."""
        return True

    @property
    def should_poll(self):
        """No polling needed."""
        return False

    @property
    def is_on(self):
        """Return true if device is on."""
        return self._state

    def turn_on(self, **kwargs):
        """Turn the device on."""
        if self._sendpacket(self._command_on):
            self._state = True
            self.schedule_update_ha_state()

    def turn_off(self, **kwargs):
        """Turn the device off."""
        if self._sendpacket(self._command_off):
            self._state = False
            self.schedule_update_ha_state()

    def _sendpacket(self, packet):
        """Send packet to device."""
        if packet is None:
            _LOGGER.debug("Empty packet.")
            return True
        try:
            self._device.send('send_ir_code', [str(packet)])
            _LOGGER.info(str(packet))
        except ValueError as error:
            _LOGGER.error(error)
            return False
        return True


text:
package httl.spi.translators.templates;

import httl.Context;
import httl.Engine;
import httl.Node;
import httl.Resource;
import httl.Template;
import httl.spi.Compiler;
import httl.spi.Converter;
import httl.spi.Filter;
import httl.spi.Formatter;
import httl.spi.Interceptor;
import httl.spi.Switcher;

import java.io.OutputStream;
import java.io.Writer;
import java.util.Map;

/**
 * Writer Template. (SPI, Prototype, ThreadSafe)
 *
 * @see httl.Engine#getTemplate(String)
 *
 * @author Liang Fei (liangfei0201 AT gmail DOT com)
 */
public abstract class WriterTemplate extends CompiledTemplate {

	public WriterTemplate(Engine engine, Interceptor interceptor, Compiler compiler,
			Switcher<Filter> filterSwitcher, Switcher<Formatter<Object>> formatterSwitcher,
			Filter filter, Formatter<Object> formatter,
			Converter<Object, Object> mapConverter, Converter<Object, Object> outConverter,
			Map<Class<?>, Object> functions, Map<String, Template> importMacros,
			Resource resource, Template template, Node root){
		super(engine, interceptor, compiler, filterSwitcher, formatterSwitcher, filter, formatter,
				mapConverter, outConverter, functions, importMacros, resource, template, root);
	}

	@Override
	protected void doRenderStream(Context context, OutputStream stream) throws Exception {
		throw new UnsupportedOperationException("Unsupported out type " + Writer.class.getName()
				+ " in compiled " + OutputStream.class.getName() + " template. Please config output.stream=true");
	}

}


text:
<?php

namespace AC\Transcoding\Preset\Handbrake;

use AC\Transcoding\Preset;

/**
 * For more information on this preset please visit this link: https://trac.handbrake.fr/wiki/BuiltInPresets#iphone4
 */
class iPhone4Preset extends BasePreset
{
    protected $key = "handbrake.iphone4";
    protected $name = "iPhone 4 Preset";
    protected $description = "HandBrake's preset for the iPhone 4 is optimized for viewing on its 960x480 display. ";

    /**
     * Specify the options for this specific preset
     */
    public function configure()
    {
        $this->setOptions(array(
            'video-library-encoder' => 'x264',
            'video-quality' => '20',
            'video-framerate' => '29.97',
            'peak-limited-frame-control-rate' => '',
            'select-audio-tracks' => '1',
            'audio-encoder' => 'faac',
            'audio-bitrate' => '160',
            'surround-sound-downmixing' => 'dp12',
            'audio-samplerate' => 'Auto',
            'dynamic-range-compression' => '0.0',
            'format' => 'mp4',
            'use-64-bit-mp4-files' => '',
            'max-width' => '960',
            'loose-anamorphic-pixel-aspect-ratio' => '',
            'add-chapter-markers' => '',
        ));
    }

}


text:
package runner

import "os/exec"

type Grepper struct {
}

func (Grepper) FileAlreadyHasStoryID(filePath string) bool {
	cmd := "grep"
	args := []string{"\\[*#[0-9]\\+\\]", filePath}
	grepMatchFound := exec.Command(cmd, args...).Run() == nil
	return grepMatchFound
}


text:
'use strict';

/**
 * Module dependencies.
 */
var mongoose = require('mongoose'),
	Schema = mongoose.Schema;

/**
 * Day Ahead data Schema
 */

var RealTimeDataSchema = mongoose.Schema({
    filePath: {type: String, index: true},
    market: {type: String},
    marketType: {type: String},
    date: {type: Date, index: true},
    Interval: {type: Date},
    GMTIntervalEnd: {type: Date},
    Settlement_Location: {type: String, index: true},
    Pnode: {type: String},
    LMP: Number,
    MLC: Number,
    MCC: Number,
    MEC: Number
});

mongoose.model('RealTimeData', RealTimeDataSchema);


text:
title: Footers
page_title: Footers - RadComboBox
description: Check our Web Forms article about Footers.
slug: combobox/templates/footers
tags: footers
published: True
position: 3
---

# Footers

**FooterTemplate** element of RadComboBox, allows the footer of the items in the drop-down list, to be customized. The footer is especially useful if the item template displays attributes in multiple columns, although it can be used with any RadComboBox item style. It could be used even when RadComboBox does not have an **ItemTemplate** defined.Just like the ItemTemplate, the FooterTemplate can include any HTML element.

The following example shows how to create a multi-column RadComboBox with a footer that labels the columns of each item.

>note Both, the **FooterTemplate** and **ItemTemplate** , lay out items using a table that fixes column width,so that the footer and items line up properly.
>

````C#
<telerik:radcombobox
id="RadComboBox1"
width="420"
height="190px"
runat="server"
highlighttemplateditems="true"
datasourceid="SqlDataSource1"
onitemdatabound="RadComboBox1_ItemDataBound">
<FooterTemplate>
	<table style="width: 415px; text-align: left">
		<tr>
			<td style="width: 125px;">Company Name</td>
			<td style="width: 125px;">City</td>
			<td style="width: 125px;">Title</td>
			<td style="width: 40px;" align="right">
				<img alt="" src="img/help.gif" />
			</td>
		</tr>
	</table>
</FooterTemplate>
<ItemTemplate>
	<table style="width: 415px; text-align: left">
	<tr>
		<td style="width: 125px;">
			<%# DataBinder.Eval(Container.DataItem, "CompanyName") %>
		 </td>
		 <td style="width: 125px;">
			<%# DataBinder.Eval(Container.DataItem, "City") %>
		 </td>
		 <td style="width: 125px;">
			<%# DataBinder.Eval(Container.DataItem, "ContactTitle") %>
		 </td>
		 <td style="width: 40px;"></td>
	 </tr>
	 </table>
</ItemTemplate>
</telerik:radcombobox>
````

In order to include data associated with every column in the text of the RadComboBox item,add an **ItemDataBound** event handler to the RadComboBox.

````C#

protected void RadComboBox1_ItemDataBound(object sender, RadComboBoxItemEventArgs e)
{
 e.Item.Text = ((DataRowView)e.Item.DataItem)["CompanyName"].ToString() + "; " +
			   ((DataRowView)e.Item.DataItem)["City"].ToString() + "; " +
			   ((DataRowView)e.Item.DataItem)["ContactTitle"].ToString();
}

````
````VB.NET

Protected Sub RadComboBox1_ItemDataBound(ByVal sender As Object, ByVal e As RadComboBoxItemEventArgs)

	e.Item.Text = (DirectCast(e.Item.DataItem, DataRowView))("CompanyName").ToString() + "; " +
				  (DirectCast(e.Item.DataItem, DataRowView))("City").ToString() + "; " +
				  (DirectCast(e.Item.DataItem, DataRowView))("ContactTitle").ToString()
End Sub

````

## Defining FooterTemplates at run-time

````ASPNET
<telerik:radcombobox
	id="RadComboBox2"
	runat="server"
	autopostback="true">
</telerik:radcombobox>
````

````C#

protected override void OnInit(EventArgs e)
{
	RadComboBox2.FooterTemplate = new FooterTemplate();
	base.OnInit(e);
}

protected void Page_Load(object sender, EventArgs e)
{
	if (!Page.IsPostBack)
	{
		RadComboBox2.Items.Add(new RadComboBoxItem("RadComboBoxItem1"));
		RadComboBox2.Items.Add(new RadComboBoxItem("RadComboBoxItem2"));
	}

	RadComboBox2.DataBind();
}

class FooterTemplate : ITemplate
{
	public void InstantiateIn(Control container)
	{
		HtmlTable table = new HtmlTable();
		HtmlTableRow row = new HtmlTableRow();
		HtmlTableCell cell = new HtmlTableCell();
		cell.InnerText = "Value";
		row.Controls.Add(cell);
		HtmlTableCell cell1 = new HtmlTableCell();
		cell1.InnerText = "Text";
		row.Controls.Add(cell1);
		table.Controls.Add(row);
		container.Controls.Add(table);
	}
}

````
````VB.NET

Protected Overloads Overrides Sub OnInit(ByVal e As EventArgs)

	RadComboBox2.FooterTemplate = New FooterTemplate()
	MyBase.OnInit(e)

End Sub

Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)

	If Not Page.IsPostBack Then

		RadComboBox2.Items.Add(New RadComboBoxItem("RadComboBoxItem1"))
		RadComboBox2.Items.Add(New RadComboBoxItem("RadComboBoxItem2"))

	End If

	RadComboBox2.DataBind()

End Sub

Class FooterTemplate Implements ITemplate

	Public Sub InstantiateIn(ByVal container As Control) Implements ITemplate.InstantiateIn
		Dim table As New HtmlTable()
		Dim row As New HtmlTableRow()
		Dim cell As New HtmlTableCell()
		cell.InnerText = "Value"
		row.Controls.Add(cell)
		Dim cell1 As New HtmlTableCell()
		cell1.InnerText = "Text"
		row.Controls.Add(cell1)
		table.Controls.Add(row)
		container.Controls.Add(table)
	End Sub

End Class

````

## Accessing controls in FooterTemplate

You can find any control embedded in the RadComboBox' FooterTemplate, like:

````C#

Label lbl = (Label)RadComboBox1.Footer.FindControl("footerLabel");
lbl.Text = "This is label in the footer";

````
````VB.NET

Dim lbl As Label = DirectCast(RadComboBox1.Footer.FindControl("footerLabel"), Label)
lbl.Text = "This is label in the footer"

````

# See Also

 * [Headers]({%slug combobox/templates/headers%})


text:
<?php

namespace Movies\UserBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Core\SecurityContext;
use Movies\UserBundle\Entity\User;

class SecurityController extends Controller
{
    public function loginAction(Request $request)
    {
        // Si le visiteur est déjà identifié, on le redirige vers l'accueil
        if ($this->get('security.context')->isGranted('IS_AUTHENTICATED_REMEMBERED')) {
            return $this->redirect($this->generateUrl('movies_home_homepage'));
        }

        $session = $request->getSession();

        // On vérifie s'il y a des erreurs d'une précédente soumission du formulaire
        if ($request->attributes->has(SecurityContext::AUTHENTICATION_ERROR)) {
            $error = $request->attributes->get(SecurityContext::AUTHENTICATION_ERROR);
        } else {
            $error = $session->get(SecurityContext::AUTHENTICATION_ERROR);
            $session->remove(SecurityContext::AUTHENTICATION_ERROR);
        }

        return $this->render('MoviesUserBundle:Security:login.html.twig', array(
                    // Valeur du précédent nom d'utilisateur entré par l'internaute
                    'last_username' => $session->get(SecurityContext::LAST_USERNAME),
                    'error'         => $error,
                    ));
    }

    public function signupAction(Request $request)
    {

        $user = new User();
        $user->setRoles(array('ROLE_USER'));
        $form = $this->get('form.factory')->createBuilder('form',$user)
            ->add('nom','text')
            ->add('prenom','text')
            ->add('username','text')
            ->add('password','password')
            ->add('email','email')
            ->add("inscrire",'submit',array('label'=>'S\'inscrire'))->getForm();

        $form->handleRequest($request);

        if ($form->isValid()) {

            $em = $this->getDoctrine()->getManager();
            $em->persist($user);
            $em->flush();
            $request->getSession()->getFlashBag()->add('notice', 'L\'utilisateur '.$user->getUsername().' à bien été enregistré !');
            return $this->redirect($this->generateUrl('movies_home_homepage'));
        }

        return $this->render('MoviesUserBundle:Security:signup.html.twig',array('form'=>$form->createView()));
    }

    public function showProfilAction($id)
    {
        $user = null;
        if($id != null)
        {
            $repository = $this->getDoctrine()->getManager()->getRepository('MoviesUserBundle:User');
            $user = $repository->find($id);
        }

        return $this->render('MoviesUserBundle:Security:profil.html.twig',array('user'=>$user));
    }

}