All posts by jorzekowsky

OV Sneak, jeden ersten Donnerstag im Cinedom in Köln

Seit Anfang 2008 gibt es wieder eine Sneak-Preview Vorstellung im Cinedom.
Die Filme laufen alle vor dem offiziellen deutschen Kinostart in der Original Version (also in englisch ohne Untertitel).

infos:

Karte: 6,50€
Begin: 23:00
Quelle: Cinedom OV-Sneak-Preview

Bisher sind folgende Filme gelaufen:
2008
2009
2010
  • The Lovely Bones Januar
  • The Men Who Stare at Goats Februar
  • Dorian Gray März
  • Cop Out April
  • The Crazies Mai
  • When in Rome Juni
  • Toy Story 3 3D Juli
  • Get Him to the Greek August
  • Dinner for Schmucks September
  • Twelve Oktober
  • Easy A November
  • Monsters Dezember
2011
  • Devil Januar
  • Tucker & Dale vs Evil Februar
  • Conviction März
  • Paul April
  • Hanna Mai
  • The Lincoln Lawyer Juni
  • Hoodwinked Too! Hood VS. Evil 3D Juli
  • Crazy, Stupid, Love. August
  • The Guard September
  • The Change-Up Oktober
  • 30 Minutes or Less November
  • Hysteria Dezember
2012
  • Drive Januar
  • Black Gold Februar
  • Contraband März
  • One for the Money April
  • 21 Jump Street Mai
  • A Few Best Men Juni
  • The Five-Year Engagement Juli
  • Prometheus 3D August
  • Seeking a Friend for the End of the World September
  • Savages Oktober
  • The Possession November
  • End of Watch Dezember
2013
  • Zero Dark Thirty Januar
  • The Master Februar
  • This Is 40 März
  • Playing for Keeps April
  • Stoker Mai
  • Promised Land Juni
  • Now You See Me Juli
  • Pain & Gain August
  • Red 2 September
  • Filth Oktober
  • Last Vegas & Escape Plan November
  • Machete Kills Dezember
2014
  • The Wolf of Wall Street Januar
  • American Hustle Februar
  • Man of Tai Chi März
  • Ride Along April
  • Enemy Mai
  • Locke Juni
  • The Young and Prodigious T.S. Spivet Juli
  • Lucy August
  • As Above, So Below September
  • What We Do in the Shadows Oktober
  • Nightcrawler November
  • Let’s Be Cops Dezember
2015

Symfony2 Tutorial Part 3: Backend with SonataAdminBundle

Updated for symfony2 2.6

Here you can find more infos on the SonataAdminBundle: http://sonata-project.org/bundles/admin

install SonataAdminBundle

You can install the bundle by simply typing the following on your console.

composer.phar require sonata-project/admin-bundle

Hint: You have to be inside your symfony project directory.

The SonataAdminBundle requires a storage Bundle to be installed. In our case we will use SonataDoctrineORMAdminBundle.
Here you will find some more information about SonataDoctrineORMAdminBundle: http://sonata-project.org/bundles/doctrine-orm-admin/master/doc/reference/installation.html
The Installation is very simple.

composer.phar require sonata-project/doctrine-orm-admin-bundle

This will simply add a line in your composer.json file and then update your vendors.

{
    "name": "jorzekowsky/simple_blog",
    "license": "proprietary",
    "type": "project",
    "autoload": {
        "psr-0": {
            "": "src/",
            "SymfonyStandard": "app/"
        }
    },
    "require": {
        "php": ">=5.3.3",
        "symfony/symfony": "2.6.*",
        "doctrine/orm": "~2.2,>=2.2.3,<2.5",
        "doctrine/dbal": "<2.5",
        "doctrine/doctrine-bundle": "~1.2",
        "twig/extensions": "~1.0",
        "symfony/assetic-bundle": "~2.3",
        "symfony/swiftmailer-bundle": "~2.3",
        "symfony/monolog-bundle": "~2.4",
        "sensio/distribution-bundle": "~3.0,>=3.0.12",
        "sensio/framework-extra-bundle": "~3.0,>=3.0.2",
        "incenteev/composer-parameter-handler": "~2.0",
        "sonata-project/admin-bundle": "^2.3",
        "sonata-project/doctrine-orm-admin-bundle": "^2.3"
    },
    "require-dev": {
        "sensio/generator-bundle": "~2.3"
    },
    "scripts": {
        "post-root-package-install": [
            "SymfonyStandard\\Composer::hookRootPackageInstall"
        ],
        "post-install-cmd": [
            "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::removeSymfonyStandardFiles",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
        ],
        "post-update-cmd": [
            "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::removeSymfonyStandardFiles",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
        ]
    },
    "config": {
        "bin-dir": "bin"
    },
    "extra": {
        "symfony-app-dir": "app",
        "symfony-web-dir": "web",
        "symfony-assets-install": "relative",
        "incenteev-parameters": {
            "file": "app/config/parameters.yml"
        }
    }
}

Hint: You can do this manually. Yu just need to add the higlighted line yourself and then run the following command on your console.

composer.phar update

Syntax is very important inside a json file so don’t forget the comma in line 23.

We will enable them in the next step.
Edit app/AppKernel.php and add the following lines so it looks like this:

<?php // app/AppKernel.php

use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;

class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
            new Symfony\Bundle\SecurityBundle\SecurityBundle(),
            new Symfony\Bundle\TwigBundle\TwigBundle(),
            new Symfony\Bundle\MonologBundle\MonologBundle(),
            new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
            new Symfony\Bundle\AsseticBundle\AsseticBundle(),
            new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
            new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),

            new Sonata\CoreBundle\SonataCoreBundle(),
            new Sonata\BlockBundle\SonataBlockBundle(),
            new Knp\Bundle\MenuBundle\KnpMenuBundle(),
            new Sonata\DoctrineORMAdminBundle\SonataDoctrineORMAdminBundle(),
            new Sonata\AdminBundle\SonataAdminBundle(),

            new AppBundle\AppBundle(),
        );

        if (in_array($this->getEnvironment(), array('dev', 'test'))) {
            $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
            $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
            $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
        }

        return $bundles;
    }

    public function registerContainerConfiguration(LoaderInterface $loader)
    {
        $loader->load(__DIR__.'/config/config_'.$this->getEnvironment().'.yml');
    }
}

Now we need to configure some of the dependencies. Just add the following lines at the bottom of your app/config/config.yml file.

# app/config/config.yml
sonata_block:
    default_contexts: [cms]
    blocks:
        # Enable the SonataAdminBundle block
        sonata.admin.block.admin_list:
            contexts:   [admin]
        # Your other blocks

Hint: you can learn more about the SonataBlockBundle here: http://sonata-project.org/bundles/block/master/doc/index.html

Now execute the following commands on your console.

php app/console assets:install web
php app/console cache:clear

Now we have installed SonataAdminBundle. In the next step we will configure it so that we are able to use it for our blog.

Configuration

First we need to define our routes in app/config/routing.yml. It should now look like this.

# app/config/routing.yml
quadspot_blog:
    resource: "@QuadspotBlogBundle/Resources/config/routing.yml"
    prefix:   /

admin:
    resource: '@SonataAdminBundle/Resources/config/routing/sonata_admin.xml'
    prefix: /admin

_sonata_admin:
    resource: .
    type: sonata_admin
    prefix: /admin

Next thing we do is create an admin class for our Post entity.
Create a file src/AppBundle/Admin/PostAdmin.php with the following content.

<?php // src/AppBundle/Admin/PostAdmin.php

namespace QAppBundle\Admin;

use Sonata\AdminBundle\Admin\Admin;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Form\FormMapper;

class PostAdmin extends Admin
{
    // Fields to be shown on create/edit forms
    protected function configureFormFields(FormMapper $formMapper)
    {
        $formMapper
            ->add('title', 'text', array('label' => 'Post Title'))
            ->add('body')
        ;
    }

    // Fields to be shown on filter forms
    protected function configureDatagridFilters(DatagridMapper $datagridMapper)
    {
        $datagridMapper
            ->add('title')
        ;
    }

    // Fields to be shown on lists
    protected function configureListFields(ListMapper $listMapper)
    {
        $listMapper
            ->addIdentifier('title')
        ;
    }
}

Now we need to define a service for this class. If we used the generate:bundle function to generate our BlogBundle we already have a yml file where we can define our new service.
Open src/Quadspot/BlogBundle/Resources/config/services.yml and add the following lines so it looks like this.

# src/AppBundle/Resources/config/services.yml
services:
    sonata.admin.post:
        class: AppBundle\Admin\PostAdmin
        tags:
            - { name: sonata.admin, manager_type: orm, group: "Content", label: "Post" }
        arguments:
            - ~
            - AppBundle\Entity\Post
            - ~
        calls:
            - [ setTranslationDomain, [AppBundle]]

Now we need to import this service, just edit the app/config/config.yml file.

# app/config/config.yml
imports:
    # ...
    - { resource: "@AppBundle/Resources/config/services.yml" }
    # ...

Now you can add, edit and delete Posts. Just visit http://symfony.yourhostname/app_dev.php/admin or http://symfony.yourhostname/admin in your production environment.

Hint: If you get a 404 error in your production environment try clearing the cache.

php app/console cache:clear --env=prod

Now I have noticed that the labels and descriptions on some of the elements in the admin backend do not look quite right. That is because the translator is not enabled by default.
You can enable it in app/config/config.yml.

# app/config/config.yml
framework:
    # ...
    translator:      { fallback: "%locale%" }
    # ...

Now there will be some error when you try to add a new post or update an existing one. This is because the created_at and updated_at field is required per default and we do not provide them with any values. We want them to be filled automatically. To do that we need to add two more methods and enable lifecyclecallbacks in our post entity in src/AppBundle/Entity/Post.php.

&lt;?php // src/AppBundle/Entity/Post.php

namespace AppBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * Post
 *
 * @ORM\Table()
 * @ORM\Entity
 * @ORM\HasLifecycleCallbacks
 */
class Post
{
    /**
     * @var integer
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * @var string
     *
     * @ORM\Column(name="title", type="string", length=255)
     */
    private $title;

    /**
     * @var \DateTime
     *
     * @ORM\Column(name="created_at", type="datetime")
     */
    private $created_at;

    /**
     * @var \DateTime
     *
     * @ORM\Column(name="updated_at", type="datetime")
     */
    private $updated_at;

    /**
     * @var string
     *
     * @ORM\Column(name="body", type="text")
     */
    private $body;


    public function __construct()
    {
        $this->created_at = $this->updated_at = new \DateTime("now");
    }

    /** @ORM\PreUpdate */
    public function updated()
    {
        $this->updated_at = new \DateTime("now");
    }

    /**
     * Get id
     *
     * @return integer 
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set title
     *
     * @param string $title
     * @return Post
     */
    public function setTitle($title)
    {
        $this->title = $title;

        return $this;
    }

    /**
     * Get title
     *
     * @return string 
     */
    public function getTitle()
    {
        return $this->title;
    }

    /**
     * Set created_at
     *
     * @param \DateTime $createdAt
     * @return Post
     */
    public function setCreatedAt($createdAt)
    {
        $this->created_at = $createdAt;

        return $this;
    }

    /**
     * Get created_at
     *
     * @return \DateTime 
     */
    public function getCreatedAt()
    {
        return $this->created_at;
    }

    /**
     * Set updated_at
     *
     * @param \DateTime $updatedAt
     * @return Post
     */
    public function setUpdatedAt($updatedAt)
    {
        $this->updated_at = $updatedAt;

        return $this;
    }

    /**
     * Get updated_at
     *
     * @return \DateTime 
     */
    public function getUpdatedAt()
    {
        return $this->updated_at;
    }

    /**
     * Set body
     *
     * @param string $body
     * @return Post
     */
    public function setBody($body)
    {
        $this->body = $body;

        return $this;
    }

    /**
     * Get body
     *
     * @return string 
     */
    public function getBody()
    {
        return $this->body;
    }
}

The __construct() method is only called once when we first create our new post. The updated() method has to be called whenever we change something.

Hint: Look at the doctrine documentation if you want to know more http://doctrine-orm.readthedocs.org/en/latest/

Now you can crate update and delete posts in your blog.

Symfony2 Tutorial Part 2: A Simple Blog

Updated for symfony2 2.6

About this tutorial

Now we can start to create a simple blog application with our newly set up symfony2 project.

If you still have your AcmeDemoBundle you can remove it now. (http://blog.quadspot.de/wordpress/symfony2/remove-acmedemobundle-in-a-symfony2-project)

  1. We use the generator to create our entity:
    php app/console doctrine:generate:entity --entity=AppBundle:Post --fields="title:string(255) created_at:datetime updated_at:datetime body:text" --no-interaction
    

    This command will have created our entity: src/AppBundle/Entity/Post.php

    &lt;?php //src/AppBundle/Entity/Post.php
    
    namespace AppBundle\Entity;
    
    use Doctrine\ORM\Mapping as ORM;
    
    /**
     * Post
     *
     * @ORM\Table()
     * @ORM\Entity
     */
    class Post
    {
        /**
         * @var integer
         *
         * @ORM\Column(name="id", type="integer")
         * @ORM\Id
         * @ORM\GeneratedValue(strategy="AUTO")
         */
        private $id;
    
        /**
         * @var string
         *
         * @ORM\Column(name="title", type="string", length=255)
         */
        private $title;
    
        /**
         * @var \DateTime
         *
         * @ORM\Column(name="created_at", type="datetime")
         */
        private $created_at;
    
        /**
         * @var \DateTime
         *
         * @ORM\Column(name="updated_at", type="datetime")
         */
        private $updated_at;
    
        /**
         * @var string
         *
         * @ORM\Column(name="body", type="text")
         */
        private $body;
    
    
        /**
         * Get id
         *
         * @return integer 
         */
        public function getId()
        {
            return $this->id;
        }
    
        /**
         * Set title
         *
         * @param string $title
         * @return Post
         */
        public function setTitle($title)
        {
            $this->title = $title;
    
            return $this;
        }
    
        /**
         * Get title
         *
         * @return string 
         */
        public function getTitle()
        {
            return $this->title;
        }
    
        /**
         * Set created_at
         *
         * @param \DateTime $createdAt
         * @return Post
         */
        public function setCreatedAt($createdAt)
        {
            $this->created_at = $createdAt;
    
            return $this;
        }
    
        /**
         * Get created_at
         *
         * @return \DateTime 
         */
        public function getCreatedAt()
        {
            return $this->created_at;
        }
    
        /**
         * Set updated_at
         *
         * @param \DateTime $updatedAt
         * @return Post
         */
        public function setUpdatedAt($updatedAt)
        {
            $this->updated_at = $updatedAt;
    
            return $this;
        }
    
        /**
         * Get updated_at
         *
         * @return \DateTime 
         */
        public function getUpdatedAt()
        {
            return $this->updated_at;
        }
    
        /**
         * Set body
         *
         * @param string $body
         * @return Post
         */
        public function setBody($body)
        {
            $this->body = $body;
    
            return $this;
        }
    
        /**
         * Get body
         *
         * @return string 
         */
        public function getBody()
        {
            return $this->body;
        }
    }
    

    Now we can create our database schema:

    php app/console doctrine:schema:create

    Hint: If your haven’t yet created your database you can do this with:

    php app/console doctrine:database:create
  2. Next we wil create a new controler and templates do retrieve the dada from the database. We use the generator functionality of symfony2 again.
    php app/console generate:doctrine:crud --entity=AppBundle:Post --no-interaction
  3. We can now remove the DefaultController and its Templates.
    Delete src/AppBundle/Controller/DefaultController.php and src/AppBundle/Resources/views/Default/index.html.twig
  4. Now we just need some entries in the database to be displayed in our blog. Open a mysql console:
    INSERT INTO `simple_blog`.`Post` (`id` ,`title` ,`created_at` ,`updated_at` ,`body`) VALUES ('1' , 'Lorem Ipsum', '2014-09-22 10:30:00', '2014-09-22 10:30:00', 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam');
    INSERT INTO `simple_blog`.`Post` (`id` ,`title` ,`created_at` ,`updated_at` ,`body`) VALUES ('2' , 'Lorem Ipsum 2', '2014-09-22 10:35:00', '2014-09-22 10:35:00', 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut');
  5. If we start our symfony server with

    php app/console server:run

    we can now access our blog with
    http://127.0.0.1:8000/app_dev.php/post/

And that’s it for now. In the next part we will create our backend so that we can add new posts and edit and delete existing ones.

Linux Mint 17

Was zu tun ist nach der Installation:

  • Home dir verschieben
  • .gitconfig, .openvpn, .thunderbird, .ssh ins neue home dir kopieren.

Pakete:

apt update && apt upgrade -y && apt install ssh nano mc vim enigmail ntp virt-manager chromium-browser openvpn diodon -y

LaTeX:

apt install rubber texlive texlive-lang-german texlive-latex-extra latex-beamer -y

Apache + PHP:

apt install acl apache2 apache2-mpm-prefork curl mysql-server php-apc php5 php5-cli php5-gd php5-intl php5-mysql php5-sqlite php5-xdebug php5-xsl phpmyadmin -y

Oracle Java:

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer

Kram für Oracle instant client und Android SDK

apt install build-essential
apt install php5-dev php-pear libaio1
apt install ia32-libs

Bash config:

echo 'export HISTCONTROL=ignoreboth:erasedups' >> ~/.bashrc
echo 'export HISTTIMEFORMAT="[%Y-%m-%d %T] "' >> ~/.bashrc

infos: http://askubuntu.com/questions/15926/how-to-avoid-duplicate-entries-in-bash-history