Hi!
On December 25 my iPhone 5 had an accident: it fell in the washing machine along with my dirty clothes. This is the story of what happened and how we recovered it.
Late on the 25th we get home from the family Christmas lunch and it´s time to give our son (7 months) his snack, when disaster strikes: I knocked over all the baby food! Soaked jeans and leather shoes all wet...
While the child was crying disconsolately, I took off my clothes and left them on the floor. Then, half naked, I went to prepare a new snack for him while my wife put the dirty clothes in the washing machine.
Finally, the baby got to eat and everyone was happy.
20 minutes later, I asked:
- Darling, have you seen my phone?
- No.
- Are you sure? Strange, as I always have it the pocket of my... F%%K F%%K F%%K !!!
After some well due cursing, we started our attempts to recover the phone:
1 - Stop the washing machine. Although it may seem obvious, I can assure you that the first reaction is to watch as the drum rotates and rotates round with the phone inside it.
2 - If the phone is on, turn it off.
3 - Wipe the entire phone with a dry cloth. All small holes and slots too.
4 - Immerse the phone for 36 hours in white rice. If you notice that the rice gets very wet, change it.
5 - Try turning on the phone. If after that, the screen still has many wet patches, shut the phone off again and put it back into the rice.
After nearly two days the iPhone will come back to life and hopefully it will be 90% functional (Some areas of the screen will not be recovered).
Monday, 4 January 2016
Wednesday, 4 November 2015
Moodle: Avoid alert message when form changed and exit page
Hello,
Sometimes in a moodleform you want to move to another page by javascript and a message appears saying "Are you sure...?"
The solution:
In your javascript code, use before call window.location:
window.onbeforeunload = null;
Best regards!
UPDATE 09/3/2015
P.D: Another option is editing the form and in the definition function add:
public function definition() {
$mform =& $this->_form;
$mform->disable_form_change_checker();
Sometimes in a moodleform you want to move to another page by javascript and a message appears saying "Are you sure...?"
The solution:
In your javascript code, use before call window.location:
window.onbeforeunload = null;
Best regards!
UPDATE 09/3/2015
P.D: Another option is editing the form and in the definition function add:
public function definition() {
$mform =& $this->_form;
$mform->disable_form_change_checker();
Tuesday, 13 October 2015
Moodle: Change current session lang in your local plugins
Hi,
I'm creating some code in my moodle local plugins and webservices and I'd like to "force" use a specific language. The solution that I found is:
$SESSION->lang = 'ca';
Best regards,
Iban Cardona.
I'm creating some code in my moodle local plugins and webservices and I'd like to "force" use a specific language. The solution that I found is:
$SESSION->lang = 'ca';
Best regards,
Iban Cardona.
Saturday, 10 October 2015
Laravel & TDD: Only test 1 file or function
Hello,
I'm developing with Laravel 5.1 and creating some testing files... http://laravel.com/docs/5.1/testing
I can test all my code executing phpunit inside my project folder but how test only one file/function:
- 1 file: phpunit tests/Auth/UserTest.php
- 1 function: phpunit --filter testRegisterControllerUser tests/Auth/UserTest.php
Best regards,
Iban Cardona.
I'm developing with Laravel 5.1 and creating some testing files... http://laravel.com/docs/5.1/testing
I can test all my code executing phpunit inside my project folder but how test only one file/function:
- 1 file: phpunit tests/Auth/UserTest.php
- 1 function: phpunit --filter testRegisterControllerUser tests/Auth/UserTest.php
Best regards,
Iban Cardona.
Location:
Barcelona, Barcelona, Espanya
Friday, 2 October 2015
Using Testing Environment with PHPunit and Laravel
Hello,
Recently I've been using phpunit with Laravel and I found this problem: How to clean or reset my test environment on every test? I did this solution:
Laravel version : 5.1
I followed this tutorial: http://laravel.com/docs/5.1/testing
I created my .env.testing file:
APP_ENV=testing
APP_DEBUG=true
APP_KEY=app_key_testing
DB_CONNECTION=mysql_testing
DB_HOST=localhost
DB_DATABASE=test
DB_USERNAME=dbusernametest
DB_PASSWORD=dbpwdtest
I changed my TestCase.php file:
class TestCase extends Illuminate\Foundation\Testing\TestCase
{
/**
* The base URL to use while testing the application.
*
* @var string
*/
protected $baseUrl = 'http://localhost';
/**
* Creates the application.
*
* @return \Illuminate\Foundation\Application
*/
public function createApplication()
{
$app = require __DIR__.'/../bootstrap/app.php';
$app->make(Illuminate\Contracts\Console\Kernel::class)->bootstrap();
return $app;
}
public function setUp()
{
exec('cp /opt/lampp/htdocs/mytestsite/.env.testing /opt/lampp/htdocs/mytestsite/.env');
parent::setUp();
Artisan::call('migrate');
}
public function tearDown()
{
Artisan::call('migrate:reset');
parent::tearDown();
exec('cp /opt/lampp/htdocs/mytestsite/.env.local /opt/lampp/htdocs/mytestsite/.env');
}
}
I hope you find it useful.
Best regards!
Recently I've been using phpunit with Laravel and I found this problem: How to clean or reset my test environment on every test? I did this solution:
Laravel version : 5.1
I followed this tutorial: http://laravel.com/docs/5.1/testing
I created my .env.testing file:
APP_ENV=testing
APP_DEBUG=true
APP_KEY=app_key_testing
DB_CONNECTION=mysql_testing
DB_HOST=localhost
DB_DATABASE=test
DB_USERNAME=dbusernametest
DB_PASSWORD=dbpwdtest
I changed my TestCase.php file:
class TestCase extends Illuminate\Foundation\Testing\TestCase
{
/**
* The base URL to use while testing the application.
*
* @var string
*/
protected $baseUrl = 'http://localhost';
/**
* Creates the application.
*
* @return \Illuminate\Foundation\Application
*/
public function createApplication()
{
$app = require __DIR__.'/../bootstrap/app.php';
$app->make(Illuminate\Contracts\Console\Kernel::class)->bootstrap();
return $app;
}
public function setUp()
{
exec('cp /opt/lampp/htdocs/mytestsite/.env.testing /opt/lampp/htdocs/mytestsite/.env');
parent::setUp();
Artisan::call('migrate');
}
public function tearDown()
{
Artisan::call('migrate:reset');
parent::tearDown();
exec('cp /opt/lampp/htdocs/mytestsite/.env.local /opt/lampp/htdocs/mytestsite/.env');
}
}
I hope you find it useful.
Best regards!
Saturday, 19 September 2015
Install XAMPP + Laravel in Ubuntu
Hello,
Ubuntu version: 14.04.3 LTS
XAMPP version: 5.6.15
Laravel version: 5.2
Install XAMPP (as root)
Ubuntu version: 14.04.3 LTS
XAMPP version: 5.6.15
Laravel version: 5.2
Install XAMPP (as root)
- chmod +x xampp-linux-x64-5.6.12-0-installer.run
- ./xampp-linux-x64-5.6.8-0-installer.run
- You will be asked to answer some questions, I sayed always Y.
- To start lampp server: /opt/lampp/lampp start
- Install composer: curl -sS https://getcomposer.org/installer | /opt/lampp/bin/php -- --install-dir=/opt/lampp/bin --filename=composer
- cd /opt/lampp/htdocs
- export PATH="$PATH:$HOME/.composer/vendor/bin"
- export PATH=$PATH:/opt/lampp/bin
- composer global require "laravel/installer"
- laravel new test
- chmod 777 /opt/lampp/htdocs/test/bootstrap/cache
- chmod -R 777 /opt/lampp/htdocs/test/storage/*
- vim /opt/lampp/etc/httpd.conf
- #Include etc/extra/httpd-vhosts.conf --> Include etc/extra/httpd-vhosts.conf
- Add in /opt/lampp/etc/extra/httpd-vhosts.conf
- <VirtualHost *:80>
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot "/opt/lampp/htdocs/test/public"
ServerName testlaravel.com
ServerAlias www.testlaravel.com
ErrorLog "logs/testlaravel-error_log"
CustomLog "logs/testlaravel-access_log" common
</VirtualHost> - /opt/lampp/lampp restart
- Add in /etc/hosts
- 127.0.0.1 testlaravel.com
- 127.0.0.1 www.testlaravel.com
Tuesday, 30 June 2015
Postgres: could not open file "/etc/ssl/certs/ssl-cert-snakeoil.pem"
Hello,
Today I had a problem starting PostgreSQL server. I saw this error:
* The PostgreSQL server failed to start. Please check the log output:
CEST FATAL: could not open file "/etc/ssl/certs/ssl-cert-snakeoil.pem"
To solve it I did these actions:
Today I had a problem starting PostgreSQL server. I saw this error:
* The PostgreSQL server failed to start. Please check the log output:
CEST FATAL: could not open file "/etc/ssl/certs/ssl-cert-snakeoil.pem"
To solve it I did these actions:
cd /etc/ssl/certs/
chown postgres ssl-cert-snakeoil.pem
chmod 777 ssl-cert-snakeoil.pem
cd /etc/ssl/private
chown postgres ssl-cert-snakeoil.key
chmod 700 ssl-cert-snakeoil.key
Best regards!!!
Subscribe to:
Posts (Atom)