OpenRemote at FOSDEM, February 4-5 2012

in Sin categoría

News Item
added by
Juha Lindfors

OpenRemote at FOSDEM

February 4-5, 2012

Brussels Belgium

Eric Bariaux will be presenting OpenRemote at the upcoming Free and Open Source Software Developer’s European Meeting (FOSDEM) this coming February, the weekend of 4th and 5th, held in Brussels, Belgium.

If you’re planning to attend, do come by and say hello!

Talk description:

“After a quick business introduction, covering the business model, the raison d’etre for a standards based, open source platform in the crowded field of home automation, this presentation will address: – the global architecture of the OpenRemote ecosystem and its components – a detail presentation of each components, their role and the technologies used – a short video of the great applications the community has used OpenRemote for – a technical walk-through of the how to implement a new protocol – the OpenRemote community”

More information about the FOSDEM conference: http://www.fosdem.org/2012/schedule/event/openremote

0 Comments

Arrancar JBoss en el puerto 80 sin ser root ni usar apache

in GNU / Linux, JBoss Community

-Arrancar en puertos por debajo del 1024 sólo lo pueden hacer usuarios privilegiados, y no se quiere usar un usuario privilegiado porque si se toma el control de este proceso se tendran los mismos privilegios que dicho usuario.

-Se puede usa Apache con mod_proxy, mod_jk, mod_cluster,… esto esta muy bien para balancear o para ofrecer recursos con Apache, pero si lo único que queremos es cambiar el puerto es demasiado.

-Para hacer lo que dice el título vamos a usar IPTABLES para hacer redireccionamiento de puertos (80 -> 8080, 443 -> 8443).

Hay que ejecutar los siguientes comandos:

iptables -F
iptables -X
iptables -t nat -A OUTPUT -d localhost -p tcp --dport 80 -j REDIRECT --to-ports 8080
iptables -t nat -A OUTPUT -d -p tcp --dport 80 -j REDIRECT --to-ports 8080
iptables -t nat -A PREROUTING -d -p tcp --dport 80 -j REDIRECT --to-ports 8080
iptables -t nat -A OUTPUT -d localhost -p tcp --dport 443 -j REDIRECT --to-ports 8443
iptables -t nat -A OUTPUT -d -p tcp --dport 443 -j REDIRECT --to-ports 8443
iptables -t nat -A PREROUTING -d -p tcp --dport 443 -j REDIRECT --to-ports 8443
/etc/init.d/iptables save
/etc/init.d/iptables restart

Para que funcione del todo hay que añadir lo siguiente al “server.xml” del jbossweb:



0 Comments

Arrancar a OpenERP-Web por el puerto 80 con un usuario diferente a root

in Sin categoría

Es bien sabido que si arrancamos un servicio en Linux en puertos por debajo de 1000 con un usuario distinto a root, el sistema no nos lo permite.

En nuestro caso, la parte web de OpenERP arranca en el puerto 8080 con el usuario openerp por lo que sólo nos queda tocar las reglas de iptables para que cuando entre por el puerto 80/443 redireccione al 8080/8443.

Agregamos las reglas:

iptables -A FORWARD -p tcp --destination-port 443 -j ACCEPT
iptables -t nat -A PREROUTING -j REDIRECT -p tcp --destination-port 443 --to-ports 8443
iptables -A FORWARD -p tcp --destination-port 80 -j ACCEPT
iptables -t nat -A PREROUTING -j REDIRECT -p tcp --destination-port 80 --to-ports 8080

Finalmente, guardamos las reglas o de lo contrario las perderemos al rearrancar el servidor:

/etc/init.d/iptables save

0 Comments

Android: No veo en el file explorer los archivos del dispositivo

in Sin categoría

Si se tiene una rom basada en CyanogenMod y no se ven los ficheros del dispositivo con el “File Explorer” del ADT con Eclipse.

Hay que cambiar el fichero “/system/bin/toolbox” del dispositivo por el que viene en el emulador del SDK de la misma version de android que la del dispositivo. Se hace de la siguiente manera:

1.- Hay que sacar el fichero del emulador:

adb pull /system/bin/toolbox .

2.- Hay que reiniciar el dispositivo en modo recovery y montar desde ahi el “/system”.

3.- Hay que poner el fichero del emulador en el dispositivo:

adb push ./toolbox /system/bin/toolbox

4.- Entrar en el dispositivo, cambiarle los permisos y crear un link para el “ls”

adb shell
# cd /system/bin
# chmod +x toolbox
# ln -s toolbox ls

5.- Reiniciar el dispositivo

6.- Comprobar entrando al “File Explorer” del ADT que ya se ve el arbol de directorios.

0 Comments

Android: Como enviar emails sin pedirle al usuario que interactue

in Sin categoría

Para enviar emails en Android se lanzan Intents que piden la interacción del usuario. Pero si queremos enviar emails en aplicaciones empresariales para temas de debug y control de errores. No se le puede estar al usuario pidiendo que este enviando emails todo el rato.

Esto no se puede hacer directamente con las librerias que vienen con Android. Para poder hacer esto se puede usar un port que hay de las JavaMail para Android.

Para ello es necesario descargar los jar que salen aqui:

Y añadirlos como librerias a nuestro proyecto.

Despues necesitamos implementar una clase que use las javamail para enviar emails como en cualquier otra aplicación Java.

Aqui voy a poner un ejemplo de una clase con la que se pueden enviar email con ficheros adjuntos:
(Como regalo o modificación los adjuntos se envian comprimidos en zip)

package mypackage;

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.util.Date;
import java.util.Properties;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;

import javax.activation.CommandMap;
import javax.activation.DataHandler;
import javax.activation.DataSource;
import javax.activation.FileDataSource;
import javax.activation.MailcapCommandMap;
import javax.mail.BodyPart;
import javax.mail.Multipart;
import javax.mail.PasswordAuthentication;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeBodyPart;
import javax.mail.internet.MimeMessage;
import javax.mail.internet.MimeMultipart;

/**
 * Clase para el envio email
 *
 */

public class Mail extends javax.mail.Authenticator {
	private String _user;
	private String _pass; 

	private String[] _to;
	private String _from; 

	private String _port;
	private String _sport; 

	private String _host; 

	private String _subject;
	private String _body; 

	private boolean _auth; 

	private boolean _debuggable; 

	private Multipart _multipart; 

	public Mail() {
		_host = "smtp.gmail.com"; // default smtp server
		_port = "465"; // default smtp port
		_sport = "465"; // default socketfactory port 

		_user = ""; // username
		_pass = ""; // password
		_from = ""; // email sent from
		_subject = ""; // email subject
		_body = ""; // email body 

		_debuggable = false; // debug mode on or off - default off
		_auth = true; // smtp authentication - default on 

		_multipart = new MimeMultipart(); 

		// There is something wrong with MailCap, javamail can not find a handler for the multipart/mixed part, so this bit needs to be added.
		MailcapCommandMap mc = (MailcapCommandMap) CommandMap.getDefaultCommandMap();
		mc.addMailcap("text/html;; x-java-content-handler=com.sun.mail.handlers.text_html");
		mc.addMailcap("text/xml;; x-java-content-handler=com.sun.mail.handlers.text_xml");
		mc.addMailcap("text/plain;; x-java-content-handler=com.sun.mail.handlers.text_plain");
		mc.addMailcap("multipart/*;; x-java-content-handler=com.sun.mail.handlers.multipart_mixed");
		mc.addMailcap("message/rfc822;; x-java-content-handler=com.sun.mail.handlers.message_rfc822");
		CommandMap.setDefaultCommandMap(mc);
	} 

	public Mail(String user, String pass) {
		this(); 

		_user = user;
		_pass = pass;
	} 

	public boolean send() throws Exception {
		Properties props = _setProperties(); 

		if(!_user.equals("") && !_pass.equals("") && _to.length > 0 && !_from.equals("") && !_subject.equals("") && !_body.equals("")) {
			Session session = Session.getInstance(props, this); 

			MimeMessage msg = new MimeMessage(session); 

			msg.setFrom(new InternetAddress(_from)); 

			InternetAddress[] addressTo = new InternetAddress[_to.length];
			for (int i = 0; i < _to.length; i++) {
				addressTo[i] = new InternetAddress(_to[i]);
			}
			msg.setRecipients(MimeMessage.RecipientType.TO, addressTo); 

			msg.setSubject(_subject);
			msg.setSentDate(new Date()); 

			// setup message body
			BodyPart messageBodyPart = new MimeBodyPart();
			messageBodyPart.setText(_body);
			_multipart.addBodyPart(messageBodyPart); 

			// Put parts in message
			msg.setContent(_multipart); 

			// send email
			Transport.send(msg); 

			return true;
		} else {
			return false;
		}
	} 

	public void addAttachment(String filename) throws Exception { 

		// Antes de adjuntar el fichero se comprime en zip
		String outputFilename = filename+".zip";
		File outputFile = new File(outputFilename);
		FileOutputStream fos = new FileOutputStream(outputFile);
		File inputFile = new File(filename);
		BufferedInputStream fis =  new BufferedInputStream(new FileInputStream(inputFile)); 

		ZipOutputStream zos = new ZipOutputStream(new BufferedOutputStream(fos));
		try {

			byte[] buffer = new byte[1024];
			ByteArrayOutputStream stream = new ByteArrayOutputStream();
			int len1 = 0;
			while ((len1 = fis.read(buffer)) != -1) {
				stream.write(buffer, 0, len1);
			}				        

			byte[] bytes = stream.toByteArray();
			ZipEntry entry = new ZipEntry(outputFilename);
			zos.putNextEntry(entry);
			zos.write(bytes);
			zos.closeEntry();
		} finally {
			zos.close();
			fos.close();
			fis.close();
		}		

		// Se adjunta el zip
		BodyPart messageBodyPart = new MimeBodyPart();
		DataSource source = new FileDataSource(outputFilename);
		messageBodyPart.setDataHandler(new DataHandler(source));
		messageBodyPart.setFileName(filename); 

		_multipart.addBodyPart(messageBodyPart);
	} 

	@Override
	public PasswordAuthentication getPasswordAuthentication() {
		return new PasswordAuthentication(_user, _pass);
	} 

	private Properties _setProperties() {
		Properties props = new Properties(); 

		props.put("mail.smtp.host", _host); 

		if(_debuggable) {
			props.put("mail.debug", "true");
		} 

		if(_auth) {
			props.put("mail.smtp.auth", "true");
		} 

		props.put("mail.smtp.port", _port);
		props.put("mail.smtp.socketFactory.port", _sport);
		props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
		props.put("mail.smtp.socketFactory.fallback", "false"); 

		return props;
	} 

	// the getters and setters
	public String getBody() {
		return _body;
	} 

	public void setBody(String _body) {
		this._body = _body;
	} 

	public String getFrom() {
		return _from;
	} 

	public void setFrom(String _from) {
		this._from = _from;
	} 

	public String[] getTo() {
		return _to;
	} 

	public void setTo(String[] _to) {
		this._to = _to;
	} 

	public String getHost() {
		return _host;
	} 

	public void setHost(String _host) {
		this._host = _host;
	}   

	public String getPort() {
		return _port;
	} 

	public void setPort(String _port) {
		this._port = _port;
	}   

	public String getSport() {
		return _sport;
	} 

	public void setSport(String _sport) {
		this._sport = _sport;
	}   

	public String getSubject() {
		return _body;
	} 

	public void setSubject(String _subject) {
		this._subject = _subject;
	}
}

Un ejemplo de uso de esta clase podria ser el siguiente:

	/**
	 * Enviar un email con fichero adjunto
	 * */
	public static void send(String emailTo, String nameTo, String emailFrom, String nameFrom,
			String subject, String body, String fileName){

		Log.d("Mail","Enviando email con los datos: "+emailTo +" / "+nameTo +" / "+emailFrom +
				" / "+nameFrom +" / "+subject +" / "+body +" / "+fileName +" / ");

		Mail m = new Mail(); 

		String[] toArr = {emailTo};
		m.setTo(toArr);
		m.setFrom(emailFrom);
		m.setSubject(subject);
		m.setBody(body); 

		try { 

			m.addAttachment(fileName); 

			if(m.send()) {
				Log.i("Mail","Se ha enviado el email con los datos: "+emailTo +" / "+nameTo +" / "+emailFrom +
						" / "+nameFrom +" / "+subject +" / "+body +" / "+fileName +" / ");
			} else {
				Log.e("Mail","No se ha podido enviar el email con los datos: "+emailTo +" / "+nameTo +" / "+emailFrom +
						" / "+nameFrom +" / "+subject +" / "+body +" / "+fileName +" / ");
			}
		} catch(Exception e) {
			Log.e("Mail",("Ha habido algun problema con el email con los datos: "+emailTo +" / "+nameTo +" / "+emailFrom +
					" / "+nameFrom +" / "+subject +" / "+body +" / "+fileName +" / ");
		}     	

	}
0 Comments

Android: Como comprimir un archivo a Zip

in Sin categoría

	public void comprimirFichero(String filename) throws Exception {
		String outputFilename = filename+".zip";
		File outputFile = new File(outputFilename);
		FileOutputStream fos = new FileOutputStream(outputFile);
		File inputFile = new File(filename);
		BufferedInputStream fis =  new BufferedInputStream(new FileInputStream(inputFile)); 

		ZipOutputStream zos = new ZipOutputStream(new BufferedOutputStream(fos));
		try {

			byte[] buffer = new byte[1024];
			ByteArrayOutputStream stream = new ByteArrayOutputStream();
			int len1 = 0;
			while ((len1 = fis.read(buffer)) != -1) {
				stream.write(buffer, 0, len1);
			}				        

			byte[] bytes = stream.toByteArray();
			ZipEntry entry = new ZipEntry(outputFilename);
			zos.putNextEntry(entry);
			zos.write(bytes);
			zos.closeEntry();
		} finally {
			zos.close();
			fos.close();
			fis.close();
		}

          return outputFilename;
      }
0 Comments

“ADT requires ‘org.eclipse.wst.sse.core 0.0.0′ but it could not be found”

in Sin categoría

Si da este error al intentar instalar el plugin ADT en Eclipse, es porque no esta activo el repositorio necesario para encontrar esa dependencia. En el caso de Eclipse Indigo el siguiente:

http://download.eclipse.org/releases/indigo

Añadirlo en “Install software…” o activarlos en “Available Software” si ya estaba añadido.

0 Comments

Android Error : ‘Debug Certificate expired. Unknown Android Packaging Problem’

in Sin categoría

Si sale el siguiente error en Eclipse o si se trabaja directamente en linea de comandos:

"Error generating final archive: Debug Certificate expired on xx/xx/xxxx  XX:XX  Unknown Android Packaging Problem"

Este error da porque el SDK genera un certificado para para desarrollo que tiene una caducidad de 365 dias.

La solución es muy sencilla, ir a “~/.android” y eliminar el archivo “debug.keystore” el SDK generará uno nuevo.

0 Comments

Error: “Root contexts can not be deployed when the virtual host configuration has the welcome root enabled, disable it and redeploy”

in JBoss Community

Este error da cuando se intenta hacer el deploy de “ROOT.WAR” en un JBoss 7.

Para poder desactivar lo que nos indica hay que hacer lo siguiente.

Modificar en el sigiente fichero:

$JBOSS_HOME/standalone/configuration/standalone.xml

Cambiar la propiedad  enable-welcome-root=false en :

<subsystem xmlns=”urn:jboss:domain:web:1.0″ default-virtual-server=”default-host”>
<connector name=”http” scheme=”http” protocol=”HTTP/1.1″ socket-binding=”http”/>
<virtual-server name=”default-host” enable-welcome-root=”false”>
<alias name=”localhost” />
<alias name=”example.com” />
</virtual-server>
</subsystem>

0 Comments

locale: Cannot set LC_CTYPE to default locale: No such file or directory

in Sin categoría

Este fallo me ha salido al arrancar una máquina virtual en Rackspace del SO Ubuntu 10.04 (Lucid):

locale: Cannot set LC_CTYPE to default locale: No such file or directory

locale: Cannot set LC_MESSAGES to default locale: No such file or directory

locale: Cannot set LC_ALL to default locale: No such file or directory

 

Desde línea de comando, me ha bastado con poner:

root@Ulteo-OVD-v3:~# apt-get install language-support-es

root@Ulteo-OVD-v3:~# dpkg-reconfigure locales

 

A continuación, he agregado al final del fichero /etc/environment las siguientes líneas:

LANG=”es_ES.utf8″

LANGUAGE=”es_ES.utf8″

LC_ALL=”es_ES.utf8″

 

Salir y volver a entrar para ver los cambios.

0 Comments

OpenRemote Russound Integration

in Sin categoría

News Item
edited by
Juha Lindfors

OpenRemote Russound Integration

Marcus Redeker is back with another video that demonstrates OpenRemote integration with Russound multi-room audio system.

The iPhone touch interface shows multi-room zone control with volume, source, bass and treble controls. Similar user interfaces can be used with iPhone and iPad tablets, Android phones and tablets and from within your PC’s web browser. This enables you to use your existing touch devices to control your audio setup without necessarily adding separate keypads for Russound control.

As an added bonus, the video shows integration of Russound touch interface with physical KNX switches. The audio can be controlled both from touch interfaces or physical switches with state synchronization across separate systems.

An Open Integration Platform

With OpenRemote, it is possible to integrate existing automation installations and equipment into a single integrated solution. You can combine your KNX light control with your Russound audio controls into a single touch interface on your smart phone or tablet – or even to existing physical switches as is demonstrated in this video.

OpenRemote establishes a de-facto integration platform for home control and automation in Open Source. We adopt Open Source to create an open, free-to-access, unencumbered platform for vendors to integrate their protocols and smart- home devices to existing automation systems at lower cost. We enable installers to create solutions where all parts of the system are integrated, controlled and automated from a single panel interface. End-users benefit from having a unified control panels which cover all their integrated devices instead of a chaos of unintegrated controls and applications that do not interoperate.

OpenRemote puts you in control – choose the most cost-effective components rather than paying over-inflated prices for a closed, proprietary solution. You can use off-the-shelf hardware and drastically reduce the cost of your installation.

0 Comments

OpenRemote Z-Wave Demo

in Sin categoría

News Item
edited by
Juha Lindfors

OpenRemote Z-Wave Demo

Marcus Redeker put together a video that shows OpenRemote controller with an iPhone user interface controlling Z-Wave enabled hardware – door sensor, light, dimmer and a motion sensor.

The Z-Wave hardware is controlled via an IP-to-ZWave gateway from HomeScenario.

We will be working on more support for Z-Wave USB sticks to add to our existing protocol integrations (KNX, Lutron, ISY-99 Insteon, X10, Z-Wave, GlobalCache, IRTrans, 1-Wire, etc).

The second part of the video shows how the UI was created with OpenRemote Designer.

0 Comments

LSWC’11

in Sin categoría

La presentación y todos los archivos usados en el taller se encuentran disponibles para su descarga en :

http://python-hispano.org/DiaPythonZGZ

Muchas gracias a todos los asistentes que fueron muchos (superando las espectativas) y que estuvieron muy atentos a todo lo que se contaba.

Y gracias a toda la organización tanto del LSWC’11, como del  PythonDayZGZ por todo el despliegue y recursos.

0 Comments

Aplicacion Seam se redespliega continuamente en JBoss 5.1.0

in Java

Hay veces que una aplicación seam se redespliega constantemente en un JBoss 5.1.0.GA

En el log del jboss se puede observar como la aplicación hace un undeploy tras ser desplegada, una y otra vez.

Esto suele estar motivado por la existencia de ficheros con extensión que no es xml (suelen ser .jsfdia o .spdia) en la carpeta META-INF de la aplicación.

Una solución es:

editar el archivo JBOSS_HOME/server/< servername>/conf/bootstrap/profile.xml

y cambiar el mbean

<bean name="DefaultDeploymentRepositoryFactory" class="org.jboss.system.server.profileservice.repository.DefaultDeploymentRepositoryFactory"> <property name="deploymentFilter"><inject bean="DeploymentFilter" /></property> <property name="checker"><inject bean="StructureModificationChecker" /></property> </bean>

por

<bean name="DefaultDeploymentRepositoryFactory" class="org.jboss.system.server.profileservice.repository.DefaultDeploymentRepositoryFactory"> <property name="deploymentFilter"><inject bean="DeploymentFilter" /></property> <property name="checker"><inject bean="MetaDataStructureModificationChecker" /></property> </bean>

y comentar en el archivo JBOSS_HOME/server//default/deployers/seam.deployer/META-INF/seam-deployers-jboss-beans.xml la siguiente declaracion

<bean name="SeamMTMatcher" class="org.jboss.seam.integration.microcontainer.deployers.SeamTempModificationTypeMatcher"/>
0 Comments

Videos from Community

in Sin categoría

News Item
edited by
Admin User

Videos from Community

The best thing about working in Open Source is when you get to see what users are able to accomplish with your software. Here Mario Neugaertner demonstrates the OpenRemote user interface he has created for his office space.

It includes control of lights and blinds and open window detection, controllable from iPad. We especially like what Mario did with the customized sliders to represent blinds in the UI. The photo work is also impressive and the UI in general looks fantastic.

Great work Mario and thanks for showing everyone where OpenRemote can go! Looking forward to the updates too

0 Comments