BOLEK's

Linux

Nunca esta demas

by on Dec.01, 2013, under Linux

Fun 'base_url' snippet!

if (!function_exists('base_url')) {
    function base_url($atRoot=FALSE, $atCore=FALSE, $parse=FALSE){
        if (isset($_SERVER['HTTP_HOST'])) {
            $http = isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off' ? 'https' : 'http';
            $hostname = $_SERVER['HTTP_HOST'];
            $dir =  str_replace(basename($_SERVER['SCRIPT_NAME']), '', $_SERVER['SCRIPT_NAME']);

            $core = preg_split('@/@', str_replace($_SERVER['DOCUMENT_ROOT'], '', realpath(dirname(__FILE__))), NULL, PREG_SPLIT_NO_EMPTY);
            $core = $core[0];

            $tmplt = $atRoot ? ($atCore ? "%s://%s/%s/" : "%s://%s/") : ($atCore ? "%s://%s/%s/" : "%s://%s%s");
            $end = $atRoot ? ($atCore ? $core : $hostname) : ($atCore ? $core : $dir);
            $base_url = sprintf( $tmplt, $http, $hostname, $end );
        }
        else $base_url = 'http://localhost/';

        if ($parse) {
            $base_url = parse_url($base_url);
            if (isset($base_url['path'])) if ($base_url['path'] == '/') $base_url['path'] = '';
        }

        return $base_url;
    }
}

Use as simple as:

echo base_url();    //  will produce something like: http://stackoverflow.com/questions/2820723/
echo base_url(TRUE);    //  will produce something like: http://stackoverflow.com/
echo base_url(TRUE, TRUE); || echo base_url(NULL, TRUE);    //  will produce something like: http://stackoverflow.com/questions/
//  and finally
echo base_url(NULL, NULL, TRUE);
//  will produce something like: 
//      array(3) {
//          ["scheme"]=>
//          string(4) "http"
//          ["host"]=>
//          string(12) "stackoverflow.com"
//          ["path"]=>
//          string(35) "/questions/2820723/"
//      }

tomado de http://stackoverflow.com/questions/2820723/how-to-get-base-url-with-php
Comments Off on Nunca esta demas more...

pdflib y php

by on Mar.12, 2013, under Linux

Install apache2 (via synaptic or package manager)

PHP Code:
sudo apt-get install apache2

install php

PHP Code:
sudo apt-get install php5

For those who don’t know 9/10 the package manager will make your apache directory: /etc/apache2 (this is where apache2.conf and an empty httpd.conf file is located) NOTE That your apache2.conf is actually the file the server is using for the settings.
And php will be /etc/php5/apache2/ (this is where php.ini is located)

To load the PDF extension.

PHP Code:
wget http://www.pdflib.com/binaries/PDFlib/801/PDFlib-8.0.1p8-Linux-php.tar.gz /tmp

NOTE: this is for x86 not x64 you can find the download page here:
http://www.pdflib.com/download/pdflib-family/pdflib-8/

after unpacking the tarball

PHP Code:
/tmp$ sudo tar -xzvf PDFlib-8.0.1p8-Linux-php.tar.gz

This will create a bind and doc directory.

under /tmp/PDFlib-8.0.1p8-Linux-php/bind/php/

php-510
php-520
php-520mt
php-530
php-530mt

There will be some sub dir’s php-530 is for php5.30 etc… the mt directories are for multithreading servers.

To check if your server is multithreading and what version of php you have you can run a test script from your /var/www/ folder. just make a file called phpinfotest.php and put this in it:
<?php phpinfo() ?>

then open the page http://localhost/phpinfotest.php

It will be quite likely that you won’t be using multi threading.

Anyhow, copy the libpdf_php.so to your extensions directory. (this is where I got lost because for some strange reason it was NOT /etc/php5/apache2/ext/ or something simple. This folder is located under the /usr/lib/php5/(some date like 20090626+lfs) in my case.

PHP Code:
sudo cp /tmp/PDFlib-8.0.1p8-Linux-php/bind/php/php-530/libpdf_php.so /usr/lib/php5/20090626+lfs/

Add the extension to your php.ini and you are done.

PHP Code:
sudo gedit /etc/php5/apache2/php.ini

add this like to where the extensions are
extension=libpdf_php.so

save & close.

restart apache2.

PHP Code:
 sudo /etc/init.d/apache2 restart

Test its working by running your phptestinfo.php again in your browser. If you can find something like:

PDF Support enabled
PDFlib GmbH Binary-Version 8.0.1p8
PECL Version 2.2.0
Revision $Revision: 1.20.2.2 $

Taken from http://ubuntuforums.org/showthread.php?t=1622815

Leave a Comment more...

Y Santa como le hace?

by on Dec.26, 2009, under Linux

Me encontre este link en slashdot.org y me parecio curioso, es el lado de la tecnológico-científico de que tendria que hacer Santa Claus para poder cumplir con sus entregas 😀 Santa en NewScientist

Leave a Comment more...

Confusión en las cuestiones de terminología Cuántica

by on Jul.14, 2009, under Linux

El otro día me salto la duda de si el dft es un método ab-initio pues lo mencione asi (y no estaba tan mal 😉 ) y pues a buscar se ha dicho y que mejor que una imagen diga mas que mil palabras.

Deutsch

Leave a Comment more...

Songbird

by on Jul.14, 2009, under Linux

Hace ya tiempo habia probado un reproductor llamado songbird, el cual me habia dejado un poco decepcionado. Y ahora con la nueva version decidi darle una nueva oportunidad, y pues me gusto!!! llevo varios dias en “try out” y creo que me quedare con el, lo unico que hecho de menos es el poder decirle que tome la musica de varias carpetas. Despues de la decepcion que me provoco amarok en su version 2. Bienvenido Songbird

Leave a Comment :, more...

Estupida tarjeta de sonido!!! Pero no pudo conmigo!!!

by on Jun.06, 2009, under Linux

Para que jale el sonido en los audifonos en las gateway M-Series hay que agregar una line al archivo alsa-base.conf
# sudo nano /etc/modprobe.d/alsa-base.conf
Se agrega la siguiente linea
options snd-hda-intel model=eapd probe_mask=1 position_fix=1
y
tata!!!!
Los audifonos y las bocinas funcionando

Por cierto honor a quien honor merece http://blog.wessendorf.org/software/headphones-with-ubuntu-904-and-gateway-t-6345u/

Leave a Comment : more...

bpython

by on Jun.03, 2009, under Linux

Una buena interfaz para python, hay que probarla. . . . . . ->Instalada!
http://www.noiseforfree.com/bpython/index.html

Leave a Comment : more...

Locales y ubuntu

by on May.27, 2009, under Linux

Hace unos días tuve problemas con gettext, apache2 y horde. Pues este ultimo no cambiaba el idioma como debería, asi que haciendo uso del sabiondo de google supe que ubuntu no tiene mucho locales por defecto asi que por eso no traducia nada al español!!!

Fue resuelto de la siguiente manera:
1.- Ver que locate es el que te interesa en “/usr/share/i18n/SUPPORTED”
2.- Agregarlo a “/var/lib/locales/supported.d/local”
3.- “sudo dpkg-reconfigure locales”
4.- “/etc/init.d/apache2 restart”
5.- tata!!!!

Con esto se resolvio 😀

Leave a Comment : more...

Entrevista para el doctorado!

by on May.25, 2009, under Linux

Erick
Mañana es mi entrevista al doctorado, estoy nervioso!!!! Se que todo saldrá bien pero me pone de nervios que otra vez me va a entrevistar la Dra. De Gyves. Por que es muy dura, se que es muy imparcial y seria en lo que hace pero pues un poco de nervios no se le niegan a nadie :D. Saliendo de la entrevista actualizaré este post para dar mis impresiones.

Leave a Comment : more...

We are linux!!!

by on Apr.14, 2009, under Linux

La fundación Linux abrio un concurso para hacer un comercial como los de mac o los de windows ese de “yo soy mac!” y aqui esta uno de los video finalistas, wow me gusto mucho por eso lo comprato con ustedes.


The Origin… from Agustin Eguia on Vimeo.

Leave a Comment : more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...