- php artisan make:controller [ControllerName]: creates a new Controller called [ControllerName].
terça-feira, 27 de setembro de 2016
Laravel command sheet
segunda-feira, 12 de setembro de 2016
Receita Bolo de Queijo
Ingredientes:
- 3 ovos;
- 100 ml de óleo de soja;
- 1 colher de sopa margarina;
- 2 xícaras de fécula de mandioca;
- 1 xícara de farinha de trigo com fermento;
- 1 xícara de leite;
- sal à gosto (eu ponho uma colher chá);
- 150g de queijo coalho;
- 7 fatias de queijo mussarela. 3 para forrar a forma e 4 para misturar com os demais ingredientes;
- Bata todos os ingredientes no liquidificador (lembre-se de deixar 3 (das 7) fatias de queijo mussarela para forrar a forma. Obs: para evitar sobrecarregar o liquidificador, bata os ingredientes em duas porções.
- Unte a forma com manteiga e farinha e forre-a com as 3 fatias de queijo mussarela. Obs: usei uma forma com dimensões de 16cm X 26cm X 4cm.
- Despeje a massa na forma e leve ao forno por aproximadamente 40 minutos à temperatura de 240 à 270 º C.
quarta-feira, 7 de setembro de 2016
MySQL Drop All Tables
SET FOREIGN_KEY_CHECKS = 0; SET @tables = NULL; SELECT GROUP_CONCAT(table_schema, '.', table_name) INTO @tables FROM information_schema.tables WHERE table_schema = '[dbName]'; -- specify DB name here. SET @tables = CONCAT('DROP TABLE ', @tables); PREPARE stmt FROM @tables; EXECUTE stmt; DEALLOCATE PREPARE stmt; SET FOREIGN_KEY_CHECKS = 1;
domingo, 14 de agosto de 2016
Cygwin bash update console screen dimensions after maximize
$ shopt -s checkwinsize $ ls $ shopt -u checkwinsize
sábado, 6 de agosto de 2016
Linux Users and Groups Management
Create new User
# adduser [userName]
Note: adduser is a Perl script the helps you tu create the user itselfs and setup their personal informations.
Delete User
# userdel [-r] [userName]
Note: If -r arg was passed, userdel will remove the [userName] home directory
Add existing user to a existing group:
# usermod -a -G [group1[,group2...]] [user]
Remove user from a group
# gpasswd -d [user] [group]
segunda-feira, 11 de julho de 2016
Cygwin Setup command line arguments
-D --download Download from internet -L --local-install Install from local directory -s --site Download site -O --only-site Ignore all sites except for -s -R --root Root installation directory -x --remove-packages Specify packages to uninstall -c --remove-categories Specify categories to uninstall -P --packages Specify packages to install -C --categories Specify entire categories to install -p --proxy HTTP/FTP proxy (host:port) -a --arch architecture to install (x86_64 or x86) -q --quiet-mode Unattended setup mode -M --package-manager Semi-attended chooser-only mode -B --no-admin Do not check for and enforce running as Administrator -h --help print help -l --local-package-dir Local package directory -r --no-replaceonreboot Disable replacing in-use files on next reboot. -X --no-verify Don't verify setup.ini signatures -n --no-shortcuts Disable creation of desktop and start menu shortcuts -N --no-startmenu Disable creation of start menu shortcut -d --no-desktop Disable creation of desktop shortcut -K --pubkey URL of extra public key file (gpg format) -S --sexpr-pubkey Extra public key in s-expr format -u --untrusted-keys Use untrusted keys from last-extrakeys -U --keep-untrusted-keys Use untrusted keys and retain all -g --upgrade-also also upgrade installed packages -o --delete-orphans remove orphaned packages -A --disable-buggy-antivirus Disable known or suspected buggy anti virus software packages during execution.
You can, for example, install packages from DOS command line:
setup-x86.exe -q -P packagename1,packagename2....
source:
SQL query to list Users in MySQL Database
sexta-feira, 1 de julho de 2016
Setting up Apache Virtual Hosts on XAMPP
C:\xampp\apache\conf\extra\httpd-vhosts.conf
# NameVirtualHost *:80 # deprecated # NameVirtualHost *:443 # deprecated <VirtualHost *:80> DocumentRoot "C:/XAMPP/htdocs" ServerName localhost </VirtualHost> <VirtualHost *:443> DocumentRoot "C:/XAMPP\htdocs" ServerName localhost SSLEngine on SSLCertificateFile "conf/ssl.crt/server.crt" SSLCertificateKeyFile "conf/ssl.key/server.key" </VirtualHost> <VirtualHost *:80> DocumentRoot "C:/xampp/htdocs/someSite" ServerName [dns] ServerAlias [fqdns] <Directory "C:/xampp/htdocs/someSite"> Options Indexes FollowSymLinks Includes ExecCGI AllowOverride All Order allow,deny Allow from all </Directory> </VirtualHost> <VirtualHost *:443> DocumentRoot "C:/xampp/htdocs/someSite" ServerName [dns] ServerAlias [fqdns] SSLEngine on SSLCertificateFile "conf/ssl.crt/server.crt" SSLCertificateKeyFile "conf/ssl.key/server.key" <Directory "C:/xampp/htdocs/someSite"> AllowOverride All Order allow,deny Allow from all </Directory> </VirtualHost>
segunda-feira, 27 de junho de 2016
domingo, 26 de junho de 2016
XAMPP set root password
Source: https://www.apachefriends.org/faq_windows.html
PHP prefered modules
PHP 5.6
- php_bz2.dll
- php_curl.dll
- php_mbstring.dll
- php_exif.dll
- php_gd2.dll
- php_gettext.dll
- php_mysql.dll
- php_mysqli.dll
- php_openssl.dll
- php_pdo_mysql.dll
- php_pdo_sqlite.dll
- php_soap.dll
- php_sockets.dll
- php_sqlite3.dll
- php_xmlrpc.dll
- php_xsl.dll
PHP 7
- php_bz2.dll
- php_curl.dll
- php_mbstring.dll
- php_exif.dll
- php_gd2.dll
- php_gettext.dll
- php_mysqli.dll
- php_openssl.dll
- php_pdo_mysql.dll
- php_pdo_sqlite.dll
- php_soap.dll
- php_sockets.dll
- php_sqlite3.dll
- php_xmlrpc.dll
- php_xsl.dll
terça-feira, 7 de junho de 2016
Activating XDebug on PHP
- Download and adequate XDebug DLL from XDebug download site section
- Place the DLL into your PHP ext folder, mine is C:\xampp\php\ext
- Edit your php.ini files and add this lines:
zend_extension = [pathToYouDLLinsideExtFolder] ;mine was: zend_extension = C:\xampp\php\ext\php_xdebug-2.4.0-5.6-vc11.dll [xdebug] xdebug.remote_enable=1 xdebug.remote_host=localhost xdebug.remote_port=9000
If you are using a Web Server to execute your scripts, restart it.
If you got some problem, use XDebug Wizard
Aptana Studio 3 Tweaks
Menu Bar > Window > Preferences > General > Appearance > Theme: Dark Studio;
Menu Bar > Window > Preferences > General > Workspace > New Text Files Line Delimiter: Unix;
Menu Bar > Window > Preferences > General > Workspace > Text File encoding: utf-8;
Menu Bar > Window > Preferences > Aptana Studio > Themes > Editor Theme: Monokai;
Menu Bar > Window > Preferences > Aptana Studio > Themes > Editor Theme > Selection: 222222;
Menu Bar > Window > Preferences > Aptana Studio > Editors > Enable Word Wrap: checked;
Menu Bar > Window > Customize Perspective > Command Groups Availabilty > Available Command Groups > External Tools: checked;
Install Aptana Studio 3 on Windows without download NodeJS by installer.
Excute the Aptana install executable specifying the extraction directory, like this:
Aptana_Studio_3_Setup_3.6.1.exe /extract:[folderToExtract]
Remembering that Aptana Studio needs a x86 version of JRE to execute.
ConEmu tweaks
ConEmu tweaks
Make CMD output in utf-8 charset
In [Startup > Enviroment > Set up enviroment variables, cmd.exe aliases, codepage] add the following line:
chcp utf8
quarta-feira, 18 de maio de 2016
Composer cheat sheet
- composer require [vendor/package]: add [vendor/package] entry to "require" attribute of composer.json
- composer install: reads the composer.json and install all packages
- composer dump-autoload: reads composer.json and generates "vendor/autoload.php" based on composer.json autoload entry.
- composer show [vendor/package] [--all]: Lists all available packages.If [vendor/package] name is supplied, it will list info about [vendor/package] package. If --all parameter is supplied, it will list info about this package taking it from remote global repository
- composer create-project [vendor/package] [projectFolderPath] [desiredPackageBranch]: create a folder [projectFolderPath] and clone the remote [vendor/package] [desiredPackageBranch] branch into this folder.
segunda-feira, 2 de maio de 2016
My VLC's prefered config
- Repeat All Playlist: Playlist > Repeat All = true;
- Diable popup on track change: Interface > Main interfaces > Qt > Show notification popup on track change = Never;
- Audio normalization:
- In Advanced mode: Tool > Preferences > Audio > Filters > Volume Normalizer=true; Tool > Preferences > Audio > Filters > Volume Normalizer > numbers of Audio Buffers = 200
- In Advanced mode: Tool > Preferences > Audio > Filters > Volume Normalizer=true; Tool > Preferences > Audio > Filters > Volume Normalizer > Maximal Volume Level = 3
- In Advanced mode: Tool > Preferences > Hotkeys > Play/pause:
- In Advanced mode: Tool > Preferences > Hotkeys > Next:
- In Advanced mode: Tool > Preferences > Hotkeys > Previous:
segunda-feira, 18 de abril de 2016
Reset MySQL root password
Reseting MySQL root password
Step One: Stop mysql service:
$sudo /etc/init.d/mysql stop Stopping MySQL database server: mysqld.
Step Two: Start to MySQL server w/o password:
$sudo mysqld_safe --skip-grant-tables & [1] 5988 Starting mysqld daemon with databases from /var/lib/mysql mysqld_safe[6025]: started
Step Three: Connect to mysql server using mysql client:
$mysql -u root Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 to server version: 4.1.15-Debian_1-log Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql>
Step Four: Setup new MySQL root user password:
mysql> use mysql; mysql> update user set password=PASSWORD("NEW-ROOT-PASSWORD") where User='root'; mysql> flush privileges; mysql> quit
Obs: if your MySQL version is 5.6 or higher, use the column authentication_string instead password.
Step Five: Stop MySQL Server:
$sudo /etc/init.d/mysql stop Stopping MySQL database server: mysqld STOPPING server from pid file /var/run/mysqld/mysqld.pid mysqld_safe[6186]: ended [1]+ Done mysqld_safe --skip-grant-tables
Step Six: Start MySQL server and test it:
$sudo /etc/init.d/mysql start $mysql -u root -p
Sources:
- http://www.cyberciti.biz/tips/recover-mysql-root-password.html
quarta-feira, 13 de abril de 2016
Great Cygwin Packages
- bash-completion,
- wget,
- curl,
- git,
- gitk,
- git-completion,
- gitweb,
- nc,
- nc6,
- vim,
- tmux
- python-setuptools: let us use python easy_install to install python packages like pip e.g.. Source: http://stackoverflow.com/questions/18641438/installing-pip-3-2-on-cygwin
- zip
- unzip
- xxd
- patch
- tree
shortly
bash-completion,wget,curl,git,gitk,git-completion,gitweb,nc,nc6,vim,tmux,python-setuptools,zip,unzip,xxd,patch,tree;
domingo, 3 de janeiro de 2016
ConEmu with CygWin and TMUX - open terminal failed: not a terminal
This days, I was surprised by ConEmu. I had used TMUX for a long time on Ubuntu, but this days, when I needed use it on Cygwin, It caught me off guard. When typed tmux, I got the following error:
$ tmux open terminal failed: not a terminal
This occur because ConEmu, at its installation setup, create a menu entry to start Cygwin with this task launching command:
set CHERE_INVOKING=1 & %ConEmuDrive%\cygwin\bin\sh.exe --login -i -new_console:C:"%ConEmuDrive%\cygwin\Cygwin.ico"
This command executes sh.exe instead of mintty.exe, the default Cygwin terminal.
To solve this problem, just change the task launching command to:
C:\cygwin\bin\mintty.exe -i /Cygwin-Terminal.ico - -new_console:C:"%ConEmuDrive%\cygwin\Cygwin.ico"
Your Cygwin installation path may be different from mine, that is 'C:\cygwin\bin\mintty.exe'. So, You must change it if your path differs.