Castell dels Torelló

Back home for Christmas (surroundings)

Some of the surroundings of my hometown (Torelló, Catalonia) during Christmas. The fog is present everywhere and almost everyday. The only way to avoid it, to climb!

Castell de Torelló (a.k.a. Castell dels moros)

Location in google maps.

Castell dels Torelló (and its fog)
Castell dels Torelló (and its fog)

La foradada

Location in google maps.

La foradada
La foradada

Cabrera

Track from La Vola to Cabrera in wikiloc.

Cabrera
Views of La Plana de Vic from Cabrera
Cabrera
Cabrera
Cabrera
Santuari de Cabrera
p_6
Views from Cabrera

Les escletxes de l’Euga

Track from Sant Privat d’en Bas in wikiloc.

p_12
Shepherd’s abandoned house
p_11
Escletxes de l’Euga (1)
p_10
Escletxes de l’Euga (2)
p_8
Escletxes de l’Euga (3)
p_9
Escletxes de l’Euga (4)

Want to know what we do eat and our traditions for Christmas? View post.

Read More

DSC01453

Tocar el cel (dels Bullnegrerus)

D’aquí un a setmana comença a Torelló, el meu poble, el que possiblement és el millor carnaval de tot Catalunya (i possiblement del món)… des del punt de vista i la manera de viure’l d’un carrossaire.

 

Des de l’any 2007, si no recordo malament, participo activament en el carnaval com un carrossaire més. Sempre recordaré l’inici d’aquesta etapa, aquell dia sopant al Triangle, quan vaig comentar a la colla que els meus pares i tiets després de gairebé 10 anys sent carrossaires ho deixaven córrer, i teniem la possibilitat d’agafar el relleu. Encara no sé com, suposo que sense pensar massa, ens vam engrescar i amb més pena que glòria va sortir al carrer l’Ave de Vendetta, la primera i última carrossa amb esperit Bullnegrerus però que aquell any ens vam anomenar Black Bulls.

 

DSC01453


Basar Xinès Bullnegrerus. Qui ens ho havia de dir unes hores després…

L’any posterior va ser el torn del cobrador del frac, seguit del xai, els pingüins, els pecats, la Merkel… i finalment les mosques. Un camí que de moment s’acaba aquí, si més no per a mi, ja que aquest any no puc participar al carnaval. Potser més aviat perquè no he pogut participar al carnaval, i és que per mi, el carnaval faria mesos que hauria començat. No és perquè no pugui ser-hi durant la setmana d’autèntica bogeria que dura (que també), sinó perquè no he pogut participar en una de les millors coses que té el nostre carnaval, i és la construcció de la carrossa, des de l’idea inicial fins l’engalanada amb purpurina que es fa el mateix matí.
Qualsevol persona que s’hagi implicat en aquest sentit, m’entendrà de seguida. Per això m’agradaria que si algú llegeix això, no s’ho pensi dues vegades i si té l’oportunitat, que ho faci. És el punt diferencial més fort del nostre carnaval, i si no volem que es perdi, s’ha de seguir.

 

També és un motiu de tristesa per mi, que els Bullnegrerus aquest any no existeixin com a tal (però això és un altre tema), per això espero que sigui un punt i seguit.

 

És per això, suposo, que a mesura que s’acosta el dia, em vé aquesta nostàlgia; recordo els bons moments morts de fred (però amb les Argus a gas) cada divendres a la nit, les apretades finals per acabar a temps reduint hores de son i temps per a fer res més, els cabrejos perquè els quatre fills de puta de sempre roben material als carrossaires, els nervis dels dies abans… i moments com els de la foto següent, els quals si no els vius en persona, no els podràs entendre mai. I és que hi va haver un dia, on els Bullnegrerus, vam tocar el cel, el nostre cel.

 

IMG_1495


2012, recollint el 3r premi, el primer va ser indescriptible.

Ens veiem aviat, Bullnegrerus!

Records des de Berlin!

 

Read More

Git(Hub) basic commands and usage

Create a local repository

Open your project folder in the chttp://www.albertcasadessus.com/wp-admin/post-new.phpommand line. Then:

git init
# to start a local repo
touch README
# Edit it, this file is required
git add .
# add all the files
git commit -m "first commit"
# do the first commit

Push it to GitHub

git remote add origin https://github.com/username/project-name.git
# create a remote repo
git push origin master
# push the commit/s to the master branch

Clone the repo to work on it from another computer

Open a terminal and go to the desired folder and:

git clone https://github.com/username/project-name.git
# now you have all the files in that computer, do all the changes
git commit -a -m "your commit text"
# commit all the changes
git push origin master
# push changes to GitHub

Update your local repo with the changes commited on github

git pull origin master
# to update the local files

Source:

Read More

Color scheme designer

For people like me who are not used to design a website from scratch, to design a website is a big deal (even if it’s just a backend).

To help you out to solve this problem (at least the color scheme one), I found this useful website http://colorschemedesigner.com/ which gives you a color set to use in your website, starting from a single hexadecimal colour. Actually I have redisigned my blog using it!

Just selecting to obtain the scheme:

 

colorscheme-picker

 

And then you can see some examples of how a website would look like.

 

colorscheme-lightpage

 

Source:

Read More

Redesign of the blog using Twitter Bootstrap

For people not very used to design a site (or the ones who are not focused in frontend development), to use a CSS Framework could be very useful. I’m one of these, and in my case I ‘ve to say that is at least, easier than starting from scratch.

As you could have seen with the title of the entry, I’ve used Twitter Bootstrap . It has been my second time using it, and I must say that it has been again a nice framework to worh with. I’ve used also the Responsive feature again, because almost the 25% of the people who visited my blog site, use mobile devices.

I’m not going to tell or describe the features that it offers or how make it works, because it is very easy to use and provide almost all the CSS styles that you would need in the frontend development of a site, and some scaffolding to get started with.

Summarizing, I can assert that I would use it in my future projects.

Sources:

 

Read More

MySQL backup and restore (mysqldump and mysql to restore)

mysqldump is an effective mysql’s native way to backup a database. With just a single command you can easily do a backup of your database. Of course, mysql provide as well a way to restore dumps.
Beyond its native way, it’s better to use this way instead of using e.g. phpmyadmin. Why? Well, first phpmyadmin don’t allow to restore backups from files highers than aproximately 2mb, and has also a limit for the dumps.
 

Backup a database.

So to backup a database, just do in a terminal/console:

mysqldump -u[user] -p[password] [dbname] > nameofdumpfile.sql

This option has more options (like backup all the databases, just some tables/databases, etc). To have a list of them, just query it by using –help flag.
 

Restore a database.

Restore a database is quite easy as well:

mysql -u[user] -p[password] [dbname] < nameofdumpfile.sql

Easy isn’t it?
If your dump file contains a CREATE DATABASE statement, you can avoid the [dbname] param.
 

Common problem on restoring a database

If you are trying to restore a database and you get the following error:

ERROR 2006 (HY000) at line XX: MySQL server has gone away

Most likely you are trying to load a bigger file than mysql configuration can handle. To solve that, just edit your mysql configuration file and restart the mysql service.

  1. Edit the file my.cnf (depending on the version or the OS, folder containing it may change)
    sudo nano /etc/mysql/my.cnf
  2. Look for the max_allowed_packet and increase it to fit the size of the file you want to load.
    [mysqld]
    max_allowed_packet=256M
  3. And finally restart the mysql service
    /etc/init.d/mysqld restart

 
Easy as it is, this can avoid you a lot of headaches.

Read More

Force download with PHP and mime types

This is a basic feature post, but I wrote it to keep it handy.

If you need to link a document/picture/video or whatever file in your website, you can do it using an a-tag <a href…> link </a> , but what if you want to force this file to be download by the user instead of be opened by the browser?

To do that, you’ll need to write a bridge script between the page and the file, and then the link as it follows:

<a href='download.php?file=filename.jpg'>download image</a>

Then in the file download.php, the important code will be:

<?php
// .... before that, you should, well
// must check the file, the path,
// code injection...
header('Content-type: application/octet-stream');
header('Content-Disposition: attachment; filename=name_of_the_file_to_show.jpg"');
readfile("path/to/".$_GET["file"]);
?>

 

You can change the content-type to help browser identifying the file type. Below I attach a list of the most common/used:

 

Extension Type
(all files) application/octet-stream
avi video/x-msvideo
bmp image/bmp
css text/css
doc application/msword
dot application/msword
eps application/postscript
gif image/gif
gtar application/x-gtar
gz application/x-gzip
htm text/html
html text/html
ico image/x-icon
jpe image/jpeg
jpeg image/jpeg
jpg image/jpeg
js application/x-javascript
latex application/x-latex
mov video/quicktime
mp2 video/mpeg
mp3 audio/mpeg
mpa video/mpeg
mpe video/mpeg
mpeg video/mpeg
mpg video/mpeg
pdf application/pdf
pps application/vnd.ms-powerpoint
ppt application/vnd.ms-powerpoint
prf application/pics-rules
ps application/postscript
qt video/quicktime
rtf application/rtf
svg image/svg+xml
swf application/x-shockwave-flash
tgz application/x-compressed
tif image/tiff
tiff image/tiff
txt text/plain
xls application/vnd.ms-excel
zip application/zip

 

Another way would be using fileinfo or other functions available in php to query a file.

Read More