• Adding a language package Ubuntu

    Instalē valodas pakotnes:

    sudo apt-get -y install language-pack-en
    sudo locale-gen fr_CA.UTF-8
    sudo dpkg-reconfigure locales
    sudo vi /etc/default/locale
    sudo reboot

    /etc/default/locale
    norāda:

    LANG="fr_CA.UTF-8"
    After the reboot, the language file for Canadian french (in the UTF-8 encoding, by the way), is included and ready to use.

    Read the rest of this entry »


  • PHP instalētie moduļi

    php -m
    php -i


  • Krāsu kods no STRING

    No STRING ģenerē HTML krāsas kodu

    function stringToColorCode($str) {
    $code = dechex(crc32($str));
    $code = substr($code, 0, 6);
    return $code;
    }


  • Linux tīkla ātruma tests

    iperf -c [ip of server] -p 65000


  • PHP kvadrātainu thumbnail griezšana

    PHP kvadrātainu thumbnail griezšana

    function LoadJpeg($imgname)
    {

    $im = @imagecreatefromjpeg($imgname);

    if(!$im)
    {

    $im = imagecreatetruecolor(150, 30);
    $bgc = imagecolorallocate($im, 255, 255, 255);
    $tc = imagecolorallocate($im, 0, 0, 0);

    imagefilledrectangle($im, 0, 0, 150, 30, $bgc);

    imagestring($im, 1, 5, 5, 'Error loading ' . $imgname, $tc);
    }
    $thumb_size = 100;
    $size = getimagesize($imgname);
    $width = $size[0];
    $height = $size[1];

    if($width> $height) {
    $x = ceil(($width - $height) / 2 );
    $width = $height;
    } elseif($height> $width) {
    $y = ceil(($height - $width) / 2);
    $height = $width;
    }
    $new_im = ImageCreatetruecolor($thumb_size,$thumb_size);
    imagecopyresampled($new_im,$im,0,0,$x,$y,$thumb_size,$thumb_size,$width,$height);

    return $new_im;
    }


  • Attēla kvadrāta thumbnail izgriezšana PHP

    function LoadJpeg($imgname,$izmers)
    {
    $im = @imagecreatefromjpeg($imgname);
    if(!$im)
    {
    $im = imagecreatetruecolor(150, 30);
    $bgc = imagecolorallocate($im, 255, 255, 255);
    $tc = imagecolorallocate($im, 0, 0, 0);
    imagefilledrectangle($im, 0, 0, 150, 30, $bgc);
    imagestring($im, 1, 5, 5, 'Error loading ' . $imgname, $tc);
    }
    $size = getimagesize($imgname);
    $width = $size[0];
    $height = $size[1];
    if($width> $height) {
    $x = ceil(($width - $height) / 2 );
    $width = $height;
    } else{
    $y = ceil(($height - $width) / 2);
    $height = $width;
    }
    $thumb_size1=$izmers;
    $thumb_size2=$izmers;

    $new_im = ImageCreatetruecolor(($thumb_size1),$thumb_size2);
    imagecopyresampled($new_im,$im,0,0,$x,$y,$thumb_size1,$thumb_size2,$width,$height);

    return $new_im;
    }


  • CSS caurspīdīgs fons

    .alpha80 {
    /* Fallback for web browsers that doesn't support RGBa */
    background: rgb(255, 255, 255) transparent;
    /* RGBa with 0.6 opacity */
    background: rgba(255, 255, 255, 0.8);
    /* For IE 5.5 - 7*/
    filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#c9ffffff, endColorstr=#c9ffffff);
    /* For IE 8*/
    -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#c9ffffff, endColorstr=#c9ffffff)";
    }


  • Mapes izmērs uz servera

    du -s /var/data/folderis
    http://www.codecoffee.com/tipsforlinux/articles/22.html


  • PDF faila Read Only daļēja likvidēšana

    Kā noņemt Read Only PDF failam?
    Uzinstalējam uz Ubuntu linuxa qpdf
    apt-get install qpdf
    Pēctam palaižam šādu komandrindu, kur skatīšanās parole ir piemēram “pavasaris”
    qpdf --password=pavasaris --decrypt orginals.pdf atkodets.pdf
    *Tiek likvidēti drukāšanas un kopēšanas atribūti.
    **Daži atribūti tomēr paliek neatlauzti


  • Linux disku tūļi

    Disku aktivitāte:
    iotop
    vmstat 1
    iostat 1
    isof
    strance -e trance=open


    strance -e trance=open -p

    Disku informācija:
    hdparm -I /dev/sda

    ……..More