How to Format a Pendrive using Linux Terminal



On this fast tutorial  I gonna show to you , how to format your pendrive using linux terminal in any distribution of linux.


Remember to change the letter of device that correspond to your device in my case X.


1)First determine you dev that correspond your pendrive
$ fdisk -l


2) Format using fat 32 using the command below:

sudo mkdosfs -n 'USB-Drive-Name' -I /dev/sdX -F 32


How to create a boot pendrive on Linux



How to create boot Pendrive to install any version of linux in your computer using terminal. :) 


Remember to change the device replacing the X , by your correct Letter related you pendrive.
$ dd if=ubuntu-16.04.1-desktop-amd64.iso of=/dev/sdX bs=1M

Or using PV to show the progress:

$ zypper in pv
$ sudo dd if=ubuntu-16.04.1-desktop-amd64.iso |pv|dd of=/dev/sdd1

GIT - HOW TO CHECK THE CURRENT BRANCH ON YOU WORK AREA WITH NETBEANS

Sometimes we need to check the current branch that we are working on Git and to ensure that we are working on the correct environment. To do This using the terminal we need to type on terminal:
$ git status


But to those that are using netbeans as your default IDE, they can use a feature named Browser Git Repository.

To access this tool access:

Right click on project folder > Git > Repository > Repository browser.



That All Folks!

Bye and Take care!

PHP xdebug on Opensuse with Netbeans



Sometime we more than die() and var_dump to debug a complex system. In these cases we need to use an advanced line debug code to PHP.

Lets get started to learn how to setup an environment in opensuse to debug or PHP applications!




Compile the PHP with the directive:


 '--enable-debug'

If you dont know how to compile you PHP check this tutorial http://fabioalvaro.blogspot.com.br/2016/07/how-to-compile-build-php-from-source-on.html

Download and compile de xdebug

asd
asd
asd

Configure the /etc/php.ini


output_buffering = Off
zend_extension="/home/fabioalvaro/Downloads/xdebug-2.4.0/xdebug-2.4.0/modules/xdebug.so"
xdebug.remote_enable=on
xdebug.remote_log="/home/fabioalvaro/logs/xdebug.log"
xdebug.remote_host=localhost
xdebug.remote_handler=dbgp
xdebug.remote_port=9000

Restart the Apache Server

/usr/local/apache2/bin/apachectl stop 
/usr/local/apache2/bin/apachectl start 

PHP xdebug on Opensuse with Netbeans



Sometime we more than die() and var_dump to debug a complex system. In these cases we need to use an advanced line debug code to PHP.

Lets get started to learn how to setup an environment in opensuse to debug or PHP applications!




Compile the PHP with the directive:


 '--enable-debug'

If you dont know how to compile you PHP check this tutorial http://fabioalvaro.blogspot.com.br/2016/07/how-to-compile-build-php-from-source-on.html

Download and compile de xdebug

https://xdebug.org/download.php
choose the option source, create a folder inside your home folder named src and extract it inside this folder  in my case /home/fabio/src/xdebug-2.4.1/
now use the commands bellow:
$ phpize
$ make -j7

Configure the /etc/php.ini


output_buffering = Off
zend_extension="/home/fabioalvaro/src/xdebug-2.4.1/modules/xdebug.so"
xdebug.remote_enable=on
xdebug.remote_log="/home/fabioalvaro/logs/xdebug.log"
xdebug.remote_host=localhost
xdebug.remote_handler=dbgp
xdebug.remote_port=9000

Restart the Apache Server

/usr/local/apache2/bin/apachectl stop 
/usr/local/apache2/bin/apachectl start 


Netbeans Uppercase, Lowercase and Switch Case - useful key combo

So, this is documented in the manual, but isn’t obvious in any menu :-
To uppercase a selection, press Control+U then U. To lowercase a selection, press Control+U then L. and to reverse case in the selection (for when you have typed a whole line of code without checking your caps lock!), press Control+U then S.
Really useful but not well known.

HOW TO COMPILE / BUILD PHP FROM SOURCE ON OPENSUSE



Hey guys this is a fasta how to teaching how to download, build and install the php from source in a opensuse distribution.


1)first of all uninstall all packages from zypper

$ zypper rm php5

2) Download the source and unzip the file ina your prefered folder: in my case /home/fabioalvaro
http://php.net/downloads.php

3) run the comands bellow
~/php-src> ./configure --prefix=$HOME/myphp
~/php-src> make -j7
~/php-src> make install
$ make test


Other configuration Possible (for me the best one! like Slackware!)

$ sudo zypper rm apache2 php5
zypper in libicu-devel libapr-util1-devel libapr1-devel

apache src folder:
$'./configure' '--with-apxs2=/usr/local/apache2/bin/apxs' '--with-config-file-path=/etc/' '--with-openssl=shared' '--with-gd=shared' '--enable-so'
$ make -j7 
$ sudo make install

To start the Apache service use the command:
/usr/local/apache2/bin/apachectl start


to make some modification in the configuration file the path is:
/usr/local/apache2/conf/httpd.conf



Now we will make the install intruction in php src folder:


Before configure we need to install some mandatory libraries:
$ zypper in autoconf bison curl-devel db-devel enchant-devel freetype2-devel gcc-c++ gmp-devel imap-devel krb5-devel libbz2-devel libevent-devel libicu-devel libmcrypt-devel libpng-devel libtidy-devel libtiff-devel libtool libxslt-devel ncurses-devel net-snmp-devel openldap2-devel pam-devel pkgconfig postfix postgresql-devel tcpd-devel unixODBC-devel update-alternatives xorg-x11-devel freetds-devel mysql-devel aspell-devel libgcrypt-devel libjpeg rpm-devel libedit-devel libjpeg-devel pcre-devel re2c sqlite-devel sqlite2-devel t1lib-devel smtp_daemon tcpd-devel libopenssl-devel libbz2-devel libcurl-devel openjpeg-devel libjpeg8-devel



$  './configure' '--with-apxs2=/usr/local/apache2/bin/apxs' '--enable-fpm' '--with-fpm-user=apache' '--with-fpm-group=apache' '--enable-maintainer-zts' '--enable-pcntl' '--enable-mbregex' '--enable-tokenizer=shared' '--with-config-file-scan-dir=/etc' '--with-config-file-path=/usr/local/apache2/conf' '--enable-mod_charset' '--with-layout=PHP' '--disable-sigchild' '--enable-xml' '--with-libxml-dir=/usr' '--enable-simplexml' '--enable-xmlreader=shared' '--enable-dom=shared' '--enable-filter' '--disable-debug' '--with-openssl=shared' '--with-zlib=shared,/usr' '--enable-bcmath=shared' '--with-bz2=shared,/usr' '--enable-calendar=shared' '--enable-ctype=shared' '--with-curl=shared' '--with-mcrypt=/usr' '--with-db4=/usr' '--enable-exif=shared' '--enable-ftp=shared' '--with-gd=shared' '--with-jpeg-dir=/usr/lib' '--with-png-dir=/usr' '--with-zlib-dir=/usr' --with-mysql --with-pdo-mysql --enable-pdo --with-config-file-path=/usr/local/apache2/conf

$ make -j7 
$ sudo make install


Output of install command:
Installing PHP SAPI module: apache2handler
/usr/local/apache2/build/instdso.sh SH_LIBTOOL='/usr/lib64/apr-1/build/libtool' libphp5.la /usr/local/a
pache2/modules
/usr/lib64/apr-1/build/libtool --mode=install install libphp5.la /usr/local/apache2/modules/
libtool: install: install .libs/libphp5.so /usr/local/apache2/modules/libphp5.so
libtool: install: install .libs/libphp5.lai /usr/local/apache2/modules/libphp5.la
libtool: install: warning: remember to run `libtool --finish /home/fabio/src/php-5.6.25/libs'
chmod 755 /usr/local/apache2/modules/libphp5.so
[activating module `php5' in /usr/local/apache2/conf/httpd.conf]
Installing shared extensions: /usr/local/lib64/extensions/no-debug-zts-20131226/
Installing PHP CLI binary: /usr/local/bin/
Installing PHP CLI man page: /usr/local/php/man/man1/
Installing PHP FPM binary: /usr/local/sbin/
Installing PHP FPM config: /usr/local/etc/
Installing PHP FPM man page: /usr/local/php/man/man8/
Installing PHP FPM status page: /usr/local/php/php/fpm/
Installing PHP CGI binary: /usr/local/bin/
Installing PHP CGI man page: /usr/local/php/man/man1/
Installing build environment: /usr/local/lib64/build/
Installing header files: /usr/local/include/php/
Installing helper programs: /usr/local/bin/
program: phpize
program: php-config
Installing man pages: /usr/local/php/man/man1/
page: phpize.1
page: php-config.1
Installing PEAR environment: /usr/local/lib64/php/
[PEAR] Archive_Tar - installed: 1.4.0
[PEAR] Console_Getopt - installed: 1.4.1
[PEAR] Structures_Graph- installed: 1.1.1
[PEAR] XML_Util - installed: 1.3.0
[PEAR] PEAR - installed: 1.10.1
Wrote PEAR system config file at: /usr/local/etc/pear.conf
You may want to add: /usr/local/lib64/php to your php.ini include_path
/home/fabio/src/php-5.6.25/build/shtool install -c ext/phar/phar.phar /usr/local/bin
ln -s -f phar.phar /usr/local/bin/phar
Installing PDO headers: /usr/local/include/php/ext/pdo/



Copy the php.ini file to the folder that we define in the compilation phase:

$ cp php.ini-development /usr/local/apache2/conf/php.ini



Final step Compile the lib intl:


cd intl
phpize
./configure --enable-intl
make
sudo make install
on /etc/php.ini uncomment the lines:


extension=openssl.so
extension=zip.so
extension=zlib.so
extension=intl.so
extension=gd.so


configure the php ini enabling the modulue ssl
extension=openssl.so

Directory of PHP Modules:

/usr/local/lib64/extensions/no-debug-zts-20131226/

enable the modules on php.ini file:
extension=bcmath.so
extension=bz2.so
extension=calendar.so
extension=ctype.so
extension=curl.so
extension=dba.so
extension=dom.so
extension=exif.so
extension=filter.so
extension=ftp.so
extension=gd.so
extension=gettext.so
extension=hash.so
extension=iconv.so
extension=intl.so
extension=json.so
extension=lista2.txt
extension=mbstring.so
extension=mcrypt.so
extension=mysqli.so
extension=mysql.so
extension=opcache.so
extension=openssl.so
extension=pcntl.so
extension=pdo_mysql.so
extension=pdo.so
extension=phar.so
extension=posix.so
extension=readline.so
extension=session.so
extension=shmop.so
extension=simplexml.so
extension=soap.so
extension=sockets.so
extension=sysvmsg.so
extension=sysvsem.so
extension=sysvshm.so
extension=tokenizer.so
extension=wddx.so
extension=xmlreader.so
extension=xmlrpc.so
extension=xml.so
extension=xmlwriter.so
extension=xsl.so
extension=zip.so
extension=zlib.so

Restart the Server

linux-srbj:~ # /usr/local/apache2/bin/apachectl stop
linux-srbj:~ # /usr/local/apache2/bin/apachectl start



Thanks guys! See you!


sources: 
https://wiki.php.net/internals/windows/stepbystepbuild
http://www.phpinternalsbook.com/build_system/building_php.html

HOW TO GENERATE LOGS TO DEBUG PERFORMANCE ON WEB SERVER PHP + MYSQL



Edit the file:
$sudo kwrite /etc/my.cnf


[mysqld] log_error = /home/fabioalvaro/logs/mysql_error.log general_log_file = /home/fabioalvaro/logs/mysql-query.log general_log = 1 expire_logs_days = 10 max_binlog_size = 100M


$ systemctl restart mysql.service


Other Configurations usefully
=====================================


# * Logging and Replication
#
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
# As of 5.1 you can enable the log at runtime!
#general_log_file        = /var/log/mysql/mysql.log
#general_log             = 1
#
# Error logging goes to syslog due to /etc/mysql/conf.d/mysqld_safe_syslog.cnf.
#
# Here you can see queries with especially long duration
#log_slow_queries       = /var/log/mysql/mysql-slow.log
#long_query_time = 2
#log-queries-not-using-indexes
#
# The following can be used as easy to replay backup logs or for replication.
# note: if you are setting up a replication slave, see README.Debian about
#       other settings you may need to change.
#server-id              = 1
#log_bin                        = /var/log/mysql/mysql-bin.log
expire_logs_days        = 10
max_binlog_size         = 100M
#binlog_do_db           = include_database_name

#binlog_ignore_db       = include_database_name

How to Raise a PHP error to log in a debug process



With this configuration you can debug your aplication using the "root's method!"



display_errors = Off
log_errors = On
error_log = /home/fabioalvaro/logs/php-errors.log


After that restart the apache server:

$ systemctl restart apache2


HOW TO INSTALL SUBLIME ON OPENSUSE



Ok. Sublime Text is not free software so why I am suggesting using it? Yes. It’s not free software, I agree. The point I am making is that GNU/Linux is a platform where you can install and use free as well as non-free applications. It very much depends on why you use GNU/Linux. If you are using it purely for software superiority then you will pick the best software from the lot; if you are using it for complete control over your computing then you will pick free software. Period. Having cleared that, let’s talk about Sublime Text Editor.

I have a MacBook Pro (I needed a decent hardware which has good screen and great battery life) and unfortunately there is a dearth of quality text editors such as Gedit or KATE which many GNU/Linux users take for granted. Sublime Text is one of the many 3rd-party applications that give a Mac user the tools that she would need. Since I have been using Sublime Text on Mac and my Chromebook, for the sake of trying it out, I went ahead and installed it on my openSUSE system as well.

Sublime Text is not free software – free as in beer as well as freedom. It’s a $70 software but it’s more or less a nagware. It will nag you once in a while to buy the licence. I am sure for how long you can use it. I have a licence for Mac so I don’t really care as I can use the same licence on multiple machines.

So if you already have Sublime Text licence and you want to use it on your openSUSE box as well, this article will help you. And as I said, you don’t need a licence to use it so you can give it a try either way.

Step #1 Grab the 32 or 64 bit tar based on your openSUSE architecture from this page
https://www.sublimetext.com/3 (use tarball for other linux distributions)
in my case I am using sublime_text_3_build_3114_x64 version

step #2 Once the package is downloaded cd to the directory where it’s downloaded and extract it:
$ tar vxjf sublime_text_3_build_3114_x64.tar.bz2 (or extract using kde right click on the file)

Steap #3 Now let’s move the extracted folder to opt directory
$ sudo mv sublime_text_3 /opt/

Step #4 Then create a symlink in bin
$ sudo ln -s /opt/sublime_text_3/sublime_text /usr/bin/sublime

Now you can easily start Sublime Text from the Konsole by running
$ sublime


In a row (to cpy and past in Terminal :) )

wget https://download.sublimetext.com/sublime_text_3_build_3114_x64.tar.bz2
tar vxjf sublime_text_3_build_3114_x64.tar.bz2
sudo mv sublime_text_3 /opt/
sudo ln -s /opt/sublime_text_3/sublime_text /usr/bin/sublime
sublime


source: http://www.linuxveda.com/2014/03/18/install-sublime-text-editor-opensuse/