Números múltiplos en php
A veces en los bucles necesitamos saber si un número es múltiplo de otro. Con un sistema de paginar los resultados, y la solución es realmente fácil:
Fuente: https://www.adaweb.es/numeros-multiplos-en-php/
Blog de eCómputo creado por Richard's Site Allabord sobre tecnología, programación, soporte a errores en equipos de cómputo, TIC's y mucho más.
1
2
3
4
5
6
7
|
$limite=20;
$numero=4;
for($i=0;$i<$limite;$i++){
if($i%$numero==0){
echo $i." es múltiplo de ".$numero;
}
}
|
$ sudo yum install dovecot
/etc/dovecot/dovecot.conf
. This example uses
the nano
text editor, but you can use any text editor that you want.nano
:$ sudo nano /etc/dovecot/dovecot.conf
protocols = imap pop3
mail_location = maildir:~/Maildir
These lines contain the following parameters:protocols
: The protocols through which users can access their
emailmail_location
: The format and the location of each user’s
mailbox/etc/dovecot/conf.d/10-auth.conf
.nano
:$ sudo nano /etc/dovecot/conf.d/10-auth.conf
auth_mechanisms = plain login
The auth_mechanisms
parameter specifies the method that the email client
uses to authenticate with Dovecot./etc/dovecot/conf.d/10-mail.conf
.nano
:sudo nano /etc/dovecot/conf.d/10-mail.conf
mail_location = maildir:~/Maildir
/etc/dovecot/conf.d/10-master.conf
.nano
:sudo nano /etc/dovecot/conf.d/10-master.conf
#unix_listener auth-userdb {
#mode = 0600
#user =
#group =
#}
# Postfix smtp-auth
unix_listener /var/spool/postfix/private/auth {
mode = 0666
user = postfix
group = postfix
}
/etc/dovecot/conf.d/20-pop3.conf
file, which enables
older and less popular email clients to connect and transmit messages
correctly.nano
:sudo nano /etc/dovecot/conf.d/20-pop3.conf
pop3_uidl_format = %08Xu%08Xv
pop3_client_workarounds = outlook-no-nuls oe-ns-eoh
sudo useradd joe.bloggs
sudo mkdir /home/joe.bloggs/Maildir
sudo chown joe.bloggs:joe.bloggs /home/joe.bloggs/Maildir
sudo chmod -R 700 /home/joe.bloggs/Maildir
chkconfig
command to verify that the Dovecot
application will run when the server is restarted:sudo chkconfig --level 345 dovecot on
sudo service dovecot start
/etc/postfix/main.cf
in
nano
:sudo nano /etc/postfix/main.cf
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
smtpd_sasl_local_domain = $myhostname
smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks, reject_unauth_destination
broken_sasl_auth_clients = yes
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
sudo service postfix restart
sudo iptables -I INPUT 2 -p tcp --dport 587 -j ACCEPT
sudo iptables -I INPUT 3 -p tcp --dport 110 -j ACCEPT
sudo iptables -I INPUT 4 -p tcp --dport 143 -j ACCEPT
sudo iptables -I INPUT 5 -p tcp --dport 993 -j ACCEPT
sudo iptables -I INPUT 6 -p tcp --dport 995 -j ACCEPT
sudo /etc/init.d/iptables save sudo /etc/init.d/iptables restart
$ sudo fdisk -lThe sample output should be like this –
Disk /dev/sdb: 15.7 GB, 15664676864 bytes 255 heads, 63 sectors/track, 1904 cylinders, total 30595072 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000 Device Boot Start End Blocks Id System /dev/sdb1 * 32 30595071 15297520 c W95 FAT32 (LBA)We can observe from the above result that, device boot, blocks, id and system format are displayed.
$ mount /dev/sdb1 /mntTo create a directory in the mounted device, use the following commands –
$ cd /mnt /mnt$ mkdir johnThe above command creates a directory called john in USB device.
/mnt$ rmdir john
$ sudo umount /dev/sdb1
$ sudo mkfs.vfat /dev/sdb1
$ sudo mkfs.ntfs /dev/sdb1
$ sudo mkfs.ext4 /dev/sdb1Congratulations! Now, you know “How to Mount USB Drive in a Linux System?”. We’ll learn more about these types of commands in our next Linux post. Keep reading!
fsck
tool. This tool is great for removing bad file blocks, as most (if not
all) corruption and unreadability comes from problems like this. To
remove the corrupted file blocks from the USB flash drive, open a
terminal window and enter the following commands.lsblk
command. This will list all of the attached disks on your system.lsblk
lsblk
command lists all disks, not just USB drives. Pay close attention to
the output, as it is easy to mistake a hard drive for a flash drive.fsck
command on either a specific partition (e.g. /dev/sdc1), or the entire
disk (e.g. /dev/sdc). Once completed, the USB drive will have a healthy
partition again and be fully operational on Linux.sudo fsck /dev/sdc1
dd
, and it works quite well.lsblk
command, and apply the same logic (remember that /dev/sdc1 is a partition, and /dev/sdc is an entire device).sudo dd if=/dev/zero of=/dev/sdc
sudo mkfs.msdos -f 32 /dev/sdc1
sudo mkfs.ext4 -f /dev/sdc1
sudo mkfs.ntfs -f /dev/sdc1
¿Cómo poner el conteo de las filas en una consulta en MySql? SELECT @rownum := @rownum + 1 AS contador, /*Contador*/ t.* /* nombre d...