jueves, 22 de septiembre de 2016

Agregar un Modal en yii2

En la vista

// Se agregan las listas

use yii\bootstrap\Modal;
use yii\helpers\Url;



 //se agrega el button
    <p>
        <?= Html::button('Agregar Entrada', ['value'=>Url::to('index.php?r=inventario/entrada-inv/create'),'class' => 'btn btn-success','id'=>'modalButton']) ?>
    </p>

// Se agrega el modal

<?php
      Modal::begin([
        'header'=>'<h4>Form</h4',
        'id'=>'modal',
        'size'=>'modal-lg',
        ]);

      echo "<div id='modalContent'></div>";

      Modal::end();


    ?>


EN EL CONTROLLER

if ($model->load(Yii::$app->request->post()) && $model->save()) {
            return $this->redirect(['index', 'id' => $model->id]);
        } else {
            return $this->renderAjax('create', [
                'model' => $model,
            ]);
        }

En el appAssets

  public $js = [
        'js/AdminLTE/app.js',
        //'//cdnjs.cloudflare.com/ajax/libs/raphael/2.1.0/raphael-min.js',
        'js/plugins/slimScroll/jquery.slimscroll.min.js',
        'js/bootstrap-multiselect.js',
        'js/custom-delete-confirm.js',
        'js/bootbox.js',
        'js/bootstrap.file-input.js',
        'js/bootstrapx-clickover.js',
        'js/main.js',
    ];

en el main.js

$(function(){
$('#modalButton').click(function(){
$('#modal').modal('show')
.find('#modalContent')
.load($(this).attr('value'));
});
});




Variables creadas al autentificar un usuaurio

        $model->id_plantel = Yii::$app->user->identity->id_plantel;
        $model->id_periodo = Yii::$app->user->identity->id_periodo;
        $model->user_reg = Yii::$app->user->identity->user_id;
        $model->fecha_reg = new \yii\db\Expression('NOW()');

miércoles, 21 de septiembre de 2016

Crear, merge y eliminar un branch GIT

$git checkout -b rama1  // se crea una rama

$touch file2.txt

$git add .

$git commit " Nuevo file"




$git checkout master  //se cambia al branch master


$git merge rama1   // se funciona el file


cesar@sisweb:~/learning-git$ git log
commit dc2c5091a18f0532853ac695cf95cbf99883d2ed
Author: Cesar Morones <cesar.morones1@gmail.com>
Date:   Wed Sep 21 09:47:51 2016 -0500

    Nuevo file

commit f8948973df81a18d809247e1e0236d5dcd137e9e
Author: Cesar Morones <cesar.morones1@gmail.com>
Date:   Wed Sep 21 09:08:17 2016 -0500

    primer commit2



martes, 20 de septiembre de 2016

Select2 en yii2

sudo composer require kartik-v/yii2-widget-select2 "*"

agregar

use yii\helpers\Html;
use yii\helpers\ArrayHelper;
use yii\widgets\ActiveForm;
use app\models\CatMatyreact;
use kartik\select2\Select2;



   <?= $form->field($model, 'id_catmat')->widget(Select2::classname(), [
       'data'=> ArrayHelper::map(CatMatyreact::find()->all(),'id','nombre'),
       'language'=> 'es',
       'options'=> ['placeholder' => 'Seleciona'],
       'pluginOptions' => [
       'allowClear' => true
       ],

    ]); ?>

martes, 13 de septiembre de 2016

Ver informacion del servidor

zeus@zeus-proliant-ml110-gen9:~$ landscape-sysinfo


  System load:  0.66             Processes:           250
  Usage of /:   3.5% of 1.76TB   Users logged in:     1
  Memory usage: 4%               IP address for eno1: 132.247.108.76
  Swap usage:   0%

  => There is 1 zombie process.

  Graph this data and manage this system at:
    https://landscape.canonical.com/

Mostrar un listado de modulosde php que se pueden instalar

cesar@sisweb:/usr/bin$ sudo apt-cache search php5-



php5-common - Common files for packages built from the php5 source
php5-curl - CURL module for php5
php5-dev - Files for PHP5 module development
php5-json - JSON module for php5
php5-readline - Readline module for php5
php5-cgi - Lenguaje de guiones embebidos en HTML para servidores (binario CGI)
php5-cli - intérprete de órdenes para el lenguaje de guión php5
php5-dbg - Símbolos de depuración para PHP5
php5-gd - Módulo GD para php5
php5-gmp - Módulo GMP para php5
php5-ldap - Módulo LDAP para php5
php5-mysql - Módulo MySQL para php5
php5-odbc - Módulo ODBC para php5
php5-pgsql - Módulo PostgreSQL para php5
php5-pspell - Módulo pspell para php5
php5-recode - Módulo recode para php5
php5-snmp - Módulo SNMP para php5
php5-sqlite - Módulo SQLite para php5
php5-tidy - Módulo tidy para php5
php5-xmlrpc - Módulo XML-RPC para php5
php5-xsl - Módulo XSL para php5
bluefish - advanced Gtk+ text editor for web and software development
libphp5-embed - HTML-embedded scripting language (Embedded SAPI library)
libssh2-php - transitional dummy package for php5-ssh2
php-smb - php wrapper for smbclient and libsmbclient-php
php5-adodb - Extension optimising the ADOdb database abstraction library
php5-apcu - APC User Cache for PHP 5
php5-enchant - Enchant module for php5
php5-facedetect - Detect faces with PHP
php5-fpm - server-side, HTML-embedded scripting language (FPM-CGI binary)
php5-gdcm - Grassroots DICOM PHP5 bindings
php5-gearman - PHP wrapper to libgearman
php5-geos - GEOS bindings for PHP
php5-gnupg - wrapper around the gpgme library
php5-igbinary - igbinary extension
php5-imagick - Provides a wrapper to the ImageMagick library
php5-interbase - interbase/firebird module for php5
php5-intl - internationalisation module for php5
php5-lasso - Library for Liberty Alliance and SAML protocols - PHP 5 bindings
php5-librdf - PHP5 language bindings for the Redland RDF library
php5-libvirt-php - libvirt bindings for PHP
php5-mapscript - php5-cgi module for MapServer
php5-memcache - memcache extension module for PHP5
php5-memcached - memcached extension module for PHP5, uses libmemcached
php5-midgard2 - Midgard2 Content Repository - PHP5 language bindings and module
php5-mongo - MongoDB database driver
php5-msgpack - PHP extension for interfacing with MessagePack
php5-mysqlnd - MySQL module for php5 (Native Driver)
php5-mysqlnd-ms - MySQL replication and load balancing module for PHP
php5-oauth - OAuth 1.0 consumer and provider extension
php5-pecl-http - pecl_http module for PHP 5 Extended HTTP Support
php5-pecl-http-dev - pecl_http module for PHP 5 Extended HTTP Support development headers
php5-phpdbg - server-side, HTML-embedded scripting language (PHPDBG binary)
php5-pinba - Pinba module for PHP 5
php5-propro - propro module for PHP 5
php5-propro-dev - propro module for PHP 5 development headers
php5-radius - Radius client library
php5-raphf - raphf module for PHP 5
php5-raphf-dev - raphf module for PHP 5 development headers
php5-redis - PHP extension for interfacing with Redis
php5-remctl - PECL module for Kerberos-authenticated command execution
php5-rrd - PHP bindings to rrd tool system
php5-sasl - Cyrus SASL Extension
php5-solr - solr module for PHP 5
php5-ssh2 - Bindings for the libssh2 library
php5-stomp - Streaming Text Oriented Messaging Protocol (STOMP) client module for PHP 5
php5-svn - PHP Bindings for the Subversion Revision control system
php5-symfony-debug - Symfony debug extension
php5-tokyo-tyrant - PHP interface to Tokyo Cabinet's network interface, Tokyo Tyrant
php5-twig - Enhance performance of the Twig template engine
php5-uprofiler - hierarchical profiler for PHP (extension)
php5-vtkgdcm - Grassroots DICOM VTK PHP bindings
php5-xcache - Fast, stable PHP opcode cacher
php5-xhprof - Hierarchical Profiler for PHP5
php5-yac - YAC (Yet Another Cache) for PHP 5
php5-zmq - ZeroMQ messaging
php5-exactimage - fast image manipulation library (PHP bindings)
php5-geoip - Módulo GeoIP para php5
php5-imap - Módulo IMAP para php5
php5-mcrypt - Módulo MCrypt para php5
php5-ming - Módulo Ming para php5
php5-ps - módulo ps para PHP 5
php5-sybase - Módulo de servidor Sybase/MS SQL para php5
php5-xdebug - Módulo Xdebug para PHP 5
php5-phalcon - High performance PHP framework
cesar@sisweb:/usr/bin$ sudo apt-cache search php5-^C
cesar@sisweb:/usr/bin$ sudo apt-cache search php5-
php5-common - Common files for packages built from the php5 source
php5-curl - CURL module for php5
php5-dev - Files for PHP5 module development
php5-json - JSON module for php5
php5-readline - Readline module for php5
php5-cgi - Lenguaje de guiones embebidos en HTML para servidores (binario CGI)
php5-cli - intérprete de órdenes para el lenguaje de guión php5
php5-dbg - Símbolos de depuración para PHP5
php5-gd - Módulo GD para php5
php5-gmp - Módulo GMP para php5
php5-ldap - Módulo LDAP para php5
php5-mysql - Módulo MySQL para php5
php5-odbc - Módulo ODBC para php5
php5-pgsql - Módulo PostgreSQL para php5
php5-pspell - Módulo pspell para php5
php5-recode - Módulo recode para php5
php5-snmp - Módulo SNMP para php5
php5-sqlite - Módulo SQLite para php5
php5-tidy - Módulo tidy para php5
php5-xmlrpc - Módulo XML-RPC para php5
php5-xsl - Módulo XSL para php5
bluefish - advanced Gtk+ text editor for web and software development
libphp5-embed - HTML-embedded scripting language (Embedded SAPI library)
libssh2-php - transitional dummy package for php5-ssh2
php-smb - php wrapper for smbclient and libsmbclient-php
php5-adodb - Extension optimising the ADOdb database abstraction library
php5-apcu - APC User Cache for PHP 5
php5-enchant - Enchant module for php5
php5-facedetect - Detect faces with PHP
php5-fpm - server-side, HTML-embedded scripting language (FPM-CGI binary)
php5-gdcm - Grassroots DICOM PHP5 bindings
php5-gearman - PHP wrapper to libgearman
php5-geos - GEOS bindings for PHP
php5-gnupg - wrapper around the gpgme library
php5-igbinary - igbinary extension
php5-imagick - Provides a wrapper to the ImageMagick library
php5-interbase - interbase/firebird module for php5
php5-intl - internationalisation module for php5
php5-lasso - Library for Liberty Alliance and SAML protocols - PHP 5 bindings
php5-librdf - PHP5 language bindings for the Redland RDF library
php5-libvirt-php - libvirt bindings for PHP
php5-mapscript - php5-cgi module for MapServer
php5-memcache - memcache extension module for PHP5
php5-memcached - memcached extension module for PHP5, uses libmemcached
php5-midgard2 - Midgard2 Content Repository - PHP5 language bindings and module
php5-mongo - MongoDB database driver
php5-msgpack - PHP extension for interfacing with MessagePack
php5-mysqlnd - MySQL module for php5 (Native Driver)
php5-mysqlnd-ms - MySQL replication and load balancing module for PHP
php5-oauth - OAuth 1.0 consumer and provider extension
php5-pecl-http - pecl_http module for PHP 5 Extended HTTP Support
php5-pecl-http-dev - pecl_http module for PHP 5 Extended HTTP Support development headers
php5-phpdbg - server-side, HTML-embedded scripting language (PHPDBG binary)
php5-pinba - Pinba module for PHP 5
php5-propro - propro module for PHP 5
php5-propro-dev - propro module for PHP 5 development headers
php5-radius - Radius client library
php5-raphf - raphf module for PHP 5
php5-raphf-dev - raphf module for PHP 5 development headers
php5-redis - PHP extension for interfacing with Redis
php5-remctl - PECL module for Kerberos-authenticated command execution
php5-rrd - PHP bindings to rrd tool system
php5-sasl - Cyrus SASL Extension
php5-solr - solr module for PHP 5
php5-ssh2 - Bindings for the libssh2 library
php5-stomp - Streaming Text Oriented Messaging Protocol (STOMP) client module for PHP 5
php5-svn - PHP Bindings for the Subversion Revision control system
php5-symfony-debug - Symfony debug extension
php5-tokyo-tyrant - PHP interface to Tokyo Cabinet's network interface, Tokyo Tyrant
php5-twig - Enhance performance of the Twig template engine
php5-uprofiler - hierarchical profiler for PHP (extension)
php5-vtkgdcm - Grassroots DICOM VTK PHP bindings
php5-xcache - Fast, stable PHP opcode cacher
php5-xhprof - Hierarchical Profiler for PHP5
php5-yac - YAC (Yet Another Cache) for PHP 5
php5-zmq - ZeroMQ messaging
php5-exactimage - fast image manipulation library (PHP bindings)
php5-geoip - Módulo GeoIP para php5
php5-imap - Módulo IMAP para php5
php5-mcrypt - Módulo MCrypt para php5
php5-ming - Módulo Ming para php5
php5-ps - módulo ps para PHP 5
php5-sybase - Módulo de servidor Sybase/MS SQL para php5
php5-xdebug - Módulo Xdebug para PHP 5
php5-phalcon - High performance PHP framework


Accesar a la configuracion de seguridad de mysql

cesar@sisweb:/usr/bin$ sudo ./mysql_secure_installation

lunes, 12 de septiembre de 2016

Link para instalar rubyOnRails en diferentes versiones d eubuntu

https://gorails.com/setup/ubuntu/15.10

Instalar prepos

Se desistala en /opt


https://prepros.io/downloads


Y se crea el icono en: ~/.local/share/applications/Prepros.desktop


el archivo contiene


#!/usr/bin/env xdg-open [Desktop Entry] Categories=Programming; Comment=Prepros is great Exec=/opt/Prepros-linux-64/Prepros Hidden=false Icon=/opt/Prepros-linux-64/prepros.png Name=Prepros Terminal=false Type=Application Version=x.y Icon[en_GB]=/opt/Prepros-linux-64/prepros.png Name[en_GB]=Prepros Comment[en_GB]=Prepros is great!


Por ultimo hay que descaragr el icono y guardarlo

/opt/Prepros-linux-64/prepros.png

Instalar ruby en ubuntu

$sudo apt-get install ruby-full

jueves, 8 de septiembre de 2016

Instalar sitio virtual en laravel

Se agrega en hosts


127.0.0.1  soporte.iems.edu.mx





se crean el archivo conf


<VirtualHost *:80>
     
        ServerName soporte.iems.edu.mx
        DocumentRoot /var/www/html/soporte/public

        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /var/www/html/soporte>
                AllowOverride All
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log
        LogLevel warn
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>


$sdo a2ensite soporte.iems.edu.mx.conf