Notas de la sección: Sin categoría

Problema en CakePHP Test AJAX con TestAction

Aparentemente, en la versión 2.7.1 se cambió la línea 376 del la clase AuthComponent en el archivo lib/Cake/Controller/Component/AuthComponent.php

Se cambió la línea 376:

$controller->redirect(null, 403);

Por estas líneas:

$controller->response->statusCode(403);
$controller->response->send();
$this->_stop();

Este cambio provoca que fallen los test que se realizan con

$_SERVER['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest';

 

Una alternativa para solucionar el problema es hacer un mock del componente Auth

$Post = $this->generate('Post', array(
 'components' => array(
 'Auth'
 )
 ));

Y devolver true en el método startup

$Post->Auth
 ->expects($this->once())
 ->method('startup')
 ->will($this->returnValue(true));

 

Keeping a process or command running after terminal has been closed

  1. Open ssh terminal to remote server
  2. Begin scp transfer as usual
  3. Background the scp process (Ctrl+Z, then bg)
  4. Disown the backgrounded process (disown)
  5. Terminate the session (exit) and the process will continue to run on the remote machine.

 

http://unix.stackexchange.com/questions/65116/does-a-scp-transfer-close-when-i-close-the-shell

http://unix.stackexchange.com/questions/89483/keeping-a-process-running-after-putty-or-terminal-has-been-closed

http://unix.stackexchange.com/questions/103731/run-a-command-without-making-me-wait

http://unix.stackexchange.com/questions/4004/how-can-i-close-a-terminal-without-killing-the-command-running-in-it

Change the default SSH port o Cambiar el puerto por defecto de SSH

Step 1

As root, use your favorite text editor (vi) to edit the sshd configuration file.
vi /etc/ssh/sshd_config

 

Step 2

Edit the line which states ‘Port 22’. But before doing so, you’ll want to read the note below. Choose an appropriate port, also making sure it not currently used on the system.

# What ports, IPs and protocols we listen for
Port 50683

 

Step 3

Switch over to the new port by restarting SSH.
/etc/init.d/ssh restart

 

Step 4

Verify SSH is listening on the new port by connecting to it. Note how the port number now needs to be declared.
ssh username@hostname.com -p 50683

 
Fuente: http://linuxlookup.com/howto/change_default_ssh_port

Agregar Directorio en Sentora o ZPanel

So, go to /etc/zpanel/configs/apache/

Edit httpd-vhosts.conf and check OpenBasedir directives in first <VirtualHost *:80> entry (first one should be panel’s vhost). If it’s not for some wierd reason, find it and remove line that looks like:

php_admin_value open_basedir «/var/zpanel/hostdata/USER/public_html/DOMAIN:/var/zpanel/temp/ etc.»

# service apache2 reload

Ionic Network Error

http://abou-kone.com/2015/04/25/ionic-there-was-a-network-error-when-running-on-genymotion/

Running Ionic with Genymotion, you might run into network issues when trying to run your application in your Genymotion device VM. The one I got was :

1
2
Application Error
There was a network error (http://192.168.56.1)

when trying to launch my app on the device. It wasn’t a firewall issue, i was successfuly able to ping my host machine from Chrome within the device. Ran some debugging from within Android Studio and saw that:

1
04-25 16:10:45.960  14405-14433/com.exam.examinous W/SystemWebViewClient﹕ URL blocked by whitelist: http://192.168.56.1:2019/

It turns out that with Cordova 5 and Ionic 1.3 you :

1
2
3
4
─$ cordova -v
5.0.0
─$ ionic -v
1.3.20

You need to add the Cordova Whitelist Plugin

1
ionic plugin add https://github.com/apache/cordova-plugin-whitelist.git

and rebuild, that should set you.

Also if you’re running into this error when trying to add a plugin:

1
2
3
4
SyntaxError: Unexpected token }
at Object.parse (native)
at getJson (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/util/metadata.js:29:31)
at Object.exports.save_fetch_metadata (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/util/metadata.js:56:24)

then check your plugins/fetch.json file for extra brackets.

Permitir CORS en Apache / Enable CORS on Apache

Fuente: http://enable-cors.org/server_apache.html

 

To add the CORS authorization to the header using Apache, simply add the following line inside either the <Directory>, <Location>, <Files> or <VirtualHost> sections of your server config (usually located in a *.conf file, such as httpd.conf or apache.conf), or within a .htaccess file:

  Header set Access-Control-Allow-Origin "*"

To ensure that your changes are correct, it is strongly reccomended that you use

apachectl -t

to check your configuration changes for errors. After this passes, you may need to reload Apache to make sure your changes are applied by running the command

sudo service apache2 reload

or

apachectl -k graceful

.

Altering headers requires the use of mod_headers. Mod_headers is enabled by default in Apache, however, you may want to ensure it’s enabled by run

a2enmod headers

Note: you can also use add rather than set, but be aware that add can add the header multiple times, so it’s likely safer to use set.

A %d blogueros les gusta esto: