<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Héctor Veiga</title>
	<atom:link href="http://www.hveiga.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.hveiga.com</link>
	<description>Ideas. Passion. Development. Success.</description>
	<lastBuildDate>Sat, 16 Mar 2013 01:42:13 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4.1</generator>
		<item>
		<title>El postre del amour</title>
		<link>http://www.hveiga.com/2012/10/el-postre-del-amour/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=el-postre-del-amour</link>
		<comments>http://www.hveiga.com/2012/10/el-postre-del-amour/#comments</comments>
		<pubDate>Tue, 02 Oct 2012 23:40:06 +0000</pubDate>
		<dc:creator>hveiga</dc:creator>
				<category><![CDATA[Recetas]]></category>
		<category><![CDATA[leche condensada]]></category>
		<category><![CDATA[postre]]></category>
		<category><![CDATA[postre del amor]]></category>

		<guid isPermaLink="false">http://www.hveiga.com/?p=249</guid>
		<description><![CDATA[Como algunos sabeis, otro de mis hobbys es la cocina. Hace tiempo aprendi a hacer un postre que una amiga apodo &#8216;el postre del amor&#8217; y desde ese momento lo bautice asi, por supuesto lo aprendi de mi madre, la &#8230; <a href="http://www.hveiga.com/2012/10/el-postre-del-amour/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">Como algunos sabeis, otro de mis hobbys es la cocina. Hace tiempo aprendi a hacer un postre que una amiga apodo &#8216;el postre del amor&#8217; y desde ese momento lo bautice asi, por supuesto lo aprendi de mi madre, la gran maestra. Es un postre rapido, sencillo y rico. Ingredientes:</p>
<ul>
<li>2 Limones</li>
<li>8 Yogures naturales (cada yogur 125gr, gracias Raquel!)</li>
<li>1 Bote grande de leche condensada (Lata 397gr)</li>
<li>Azucar</li>
<li>Ron</li>
<li>Topping a elegir (pepitas de chocolate, lacasitos&#8230;) y Mikado</li>
</ul>
<p style="text-align: justify;">Limpiamos bien los limones y cogemos una fuente grande. Cogemos un rayador y rayamos la piel de los limones y la pone en la fuente. La rayadura cuanto mas fina mejor para que luego no se note demasiado. Una vez tenemos ambos limones rayados cogemos uno de ellos y lo exprimimos (si queremos mas sabor a limon, exprimir ambos). Echamos un chorrito de ron y vaciamos todos los yogures y el bote de leche condensada en la fuente. Removemos bien para que se mezcle todo bien y vamos añadiendo azucar y probando hasta que este al gusto.</p>
<p style="text-align: justify;">Lo metemos todo en la nevera para que se enfrie. Una vez frio, lo echamos en un vaso y echamos el topping que queramos un palito de Mikado para decorar.</p>
<p style="text-align: justify;">Por Copenhague ya estan disfrutando de ello, ¿o no Lucia? <img src='http://www.hveiga.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p style="text-align: center;"><a href="http://www.hveiga.com/2012/10/el-postre-del-amour/561645_4656139568540_249930604_n/" rel="attachment wp-att-250"><img class="wp-image-250 aligncenter" title="PostreLucia" src="http://www.hveiga.com/data/561645_4656139568540_249930604_n.jpg" alt="" width="343" height="343" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.hveiga.com/2012/10/el-postre-del-amour/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[HOW-TO] Creating a REST webservice with Python and Bottle</title>
		<link>http://www.hveiga.com/2012/06/how-to-create-a-rest-webservice-with-python-and-bottle/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=how-to-create-a-rest-webservice-with-python-and-bottle</link>
		<comments>http://www.hveiga.com/2012/06/how-to-create-a-rest-webservice-with-python-and-bottle/#comments</comments>
		<pubDate>Tue, 26 Jun 2012 04:45:05 +0000</pubDate>
		<dc:creator>hveiga</dc:creator>
				<category><![CDATA[How-to]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[bottle]]></category>
		<category><![CDATA[map]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[request]]></category>
		<category><![CDATA[REST]]></category>
		<category><![CDATA[route]]></category>
		<category><![CDATA[webservice]]></category>

		<guid isPermaLink="false">http://www.hveiga.com/?p=196</guid>
		<description><![CDATA[Nowadays there are mutiple web applications that need to provide an API to let the rest of the world interact with its services. One approach to achieve a fast, easy-to-develop and easy-to-use API is using REST.  If you don&#8217;t know &#8230; <a href="http://www.hveiga.com/2012/06/how-to-create-a-rest-webservice-with-python-and-bottle/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">Nowadays there are mutiple web applications that need to provide an API to let the rest of the world interact with its services. One approach to achieve a fast, easy-to-develop and easy-to-use API is using <a href="http://en.wikipedia.org/wiki/Representational_state_transfer" target="_blank">REST</a>.  If you don&#8217;t know what is REST about, I recommend you this video: <a href="http://bitworking.org/news/373/An-Introduction-to-REST" target="_blank">An introduction to REST</a>.</p>
<p style="text-align: justify;">This time I am using Python to develop the example. We are going to need a python web framework called <a href="http://bottlepy.org/docs/dev/" target="_blank">Bottle</a> which makes the creation of the REST service a piece of cake. Bottle runs with <strong>Python 2.5+ and 3.x</strong>, make sure you are using a supported version. You can download Bottle from <a href="http://pypi.python.org/pypi/bottle">PyPI</a> or install it via:</p>
<pre>pip install bottle</pre>
<p style="text-align: justify;">Code is very straight-forward. We need to import bottle route, run and request. Each time we want to map a request, all we need is to define @route(&#8216;/map&#8217;, method=&#8217;REST_METHOD&#8217;) above the method that will manage that request. For example: @route(&#8216;/helloworld&#8217;, method=&#8217;GET&#8217;). That would take account of /helloworld and will generate a response for that request. Also, Bottle framework provides a method to wait and attend the requests: run(). It is configurable (host, port, server name&#8230;) but if you call it without parameters it will start a server listening to localhost:8080.</p>
<p style="text-align: justify;">As a response, we should provide the requested information in JSON or XML format. Python has libraries to make this duty easy. These formats are used because they are easy to parse.</p>
<p style="text-align: justify;">Bottle framework has capabilities to read from Cookies, HTTP Headers and Query Variables as well. There is more information about in <a href="http://bottlepy.org/docs/dev/tutorial.html">http://bottlepy.org/docs/dev/tutorial.html</a>. Here, there is a little example to create the REST API:</p>
<pre class="brush:python">'''
Created on 26/06/2012
@author: Héctor Veiga. hveiga.com
'''
import bottle
from bottle import route,run,request

@route('/helloworld', method='GET')
def hello():
    return 'Hello World!'

 # JSON format response
@route('/book/:id', method='GET')
def book():

    return {'id':id, 'name':'A Game of Thrones: A Song of Ice and Fire'}

# Query string is /action?id=4&amp;op=6. JSON format response
@route('/action')
def select_action():

    action_id = request.query.id
    option = request.query.op

    return {'action_id':action_id, 'option':option, 'result':'200 OK'}

# Image there is a text input named 'title' and a file input name 'image'
@route('/upImage', method='POST')
def upload_image():
    title = request.forms.title
    image = request.files.image
    if title and image and image.file:
        raw_data = image.file.read()
        filename = image.filename
        return 'Image uploaded!'
    return 'Something went wrong. Please try again'</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.hveiga.com/2012/06/how-to-create-a-rest-webservice-with-python-and-bottle/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[HOW-TO] Installing and using RabbitMQ in Ubuntu</title>
		<link>http://www.hveiga.com/2012/06/how-to-installing-and-using-rabbitmq-in-ubuntu/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=how-to-installing-and-using-rabbitmq-in-ubuntu</link>
		<comments>http://www.hveiga.com/2012/06/how-to-installing-and-using-rabbitmq-in-ubuntu/#comments</comments>
		<pubDate>Thu, 21 Jun 2012 00:26:35 +0000</pubDate>
		<dc:creator>hveiga</dc:creator>
				<category><![CDATA[How-to]]></category>
		<category><![CDATA[Amazon]]></category>
		<category><![CDATA[amqp]]></category>
		<category><![CDATA[messaging]]></category>
		<category><![CDATA[queue]]></category>
		<category><![CDATA[queueing]]></category>
		<category><![CDATA[rabbitmq]]></category>
		<category><![CDATA[sqs]]></category>

		<guid isPermaLink="false">http://www.hveiga.com/?p=181</guid>
		<description><![CDATA[&#160; &#160; RabbitMQ is a powerful open source messaging system that implements the Advanced Message Queuing Protocol (AMQP) standard. Nowadays, there are thousand of applications that need a reliable messaging service to queue, for example, requests. Amazon offers a messaging service called Simple &#8230; <a href="http://www.hveiga.com/2012/06/how-to-installing-and-using-rabbitmq-in-ubuntu/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>&nbsp;</p>
<p><img class="aligncenter" title="RabbitMQ Logo" src="http://www.rabbitmq.com/img/rabbitmq_logo_strap.png" alt="" width="361" height="76" /></p>
<p>&nbsp;</p>
<p style="text-align: justify;"><a href="http://www.rabbitmq.com/" target="_blank">RabbitMQ</a> is a powerful open source messaging system that implements the <a title="Advanced Message Queuing Protocol" href="http://en.wikipedia.org/wiki/Advanced_Message_Queuing_Protocol" target="_blank">Advanced Message Queuing Protocol</a> (AMQP) standard. Nowadays, there are thousand of applications that need a reliable messaging service to queue, for example, requests. Amazon offers a messaging service called Simple Queue Service (SQS) which is suitable for little project where the message load is not very heavy.</p>
<p style="text-align: justify;">Amazon&#8217;s SQS could seem very cheap ($0.01 per 10,000 Amazon SQS Requests)  but if your application is repeatedly checking for new messages from several queues, the cost starts to matter. RabbitMQ is the solution. RabbitMQ is fast, free, supports clustering, easy-to-use, easy-to-install&#8230; However, there is one point that you need to take special care: availability. High-availability comes for free with Amazon SQS. You can find more information about RabbitMQ vs SQS <a href="http://www.nsono.net/blog/?p=3" target="_blank">here</a>.</p>
<p>Let&#8217;s install and configure. We need to add a new repository to download RabbitMQ, so let&#8217;s open a new terminal and run:</p>
<pre>sudo pico /etc/apt/sources.list</pre>
<p>This file contains the repositories sources. Move to the end of the file and write:</p>
<pre>deb http://www.rabbitmq.com/debian/ testing main</pre>
<p>Now we need a public key to avoid warnings, so run:</p>
<pre>wget http://www.rabbitmq.com/rabbitmq-signing-key-public.asc
sudo apt-key add rabbitmq-signing-key-public.asc</pre>
<p>It should have replied &#8216;OK&#8217; when adding the key. So, let&#8217;s update and download RabbitMQ:</p>
<pre>sudo apt-get update
sudo apt-get install rabbitmq-server</pre>
<p>RabbitMQ comes with a handy tool called &#8216;rabbitmqctl&#8217; to control the application (it must be used as root). To make our system a little more secure, we should set up a password for the &#8216;guest&#8217; user. I am using &#8216;abcde&#8217; as example. We can do this running:</p>
<pre>sudo rabbitmqctl change_password guest abcde</pre>
<p>Now everything is ready to start using it. Remember if you are using a remote server to open RabbitMQ&#8217;s default port 5672 in the firewall to accept connections. To test it, we are using the <a href="http://www.rabbitmq.com/java-client.html" target="_blank">Official Java Client</a>. You&#8217;ll need the libraries to run this code:</p>
<pre class="brush:java">package com.hveiga;

import java.io.IOException;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;
import com.rabbitmq.client.ConsumerCancelledException;
import com.rabbitmq.client.QueueingConsumer;
import com.rabbitmq.client.ShutdownSignalException;

public class TestRabbitMQ {

	private static String QUEUE_NAME = "TestQueue";
	private static ConnectionFactory factory = new ConnectionFactory();

	private static void init() {
	    factory.setHost("localhost"); // Host will be different if you are in remotes
	    factory.setUsername("guest");
	    factory.setPassword("abcde");
	}

	public static void send(String message) throws IOException {
	    Connection connection = factory.newConnection();
	    Channel channel = connection.createChannel();
	    channel.queueDeclare(QUEUE_NAME, false, false, false, null);

	    channel.basicPublish("", QUEUE_NAME, null, message.getBytes());
	    System.out.println(" [S] Message Sent: '" + message + "'");
	    channel.close();
	    connection.close();
	}

	public static void receive() throws IOException, ShutdownSignalException, ConsumerCancelledException, InterruptedException {
	    Connection connection = factory.newConnection();
	    Channel channel = connection.createChannel();

	    channel.queueDeclare(QUEUE_NAME, false, false, false, null);

	    QueueingConsumer consumer = new QueueingConsumer(channel);
	    channel.basicConsume(QUEUE_NAME, true, consumer);

	    QueueingConsumer.Delivery delivery = consumer.nextDelivery();
	    String message = new String(delivery.getBody());
	    System.out.println(" [R] Message Received: '" + message + "'");
	}

	public static void main(String[] args) {
		init();

		try {
			send("HelloWorld!");
			Thread.sleep(2000);
			receive();
		} catch (Exception e) {
			e.printStackTrace();
		}

	}
}</pre>
<p>&nbsp;</p>
<p style="text-align: justify;">More example and different uses can be found in the <a href="http://www.rabbitmq.com/getstarted.html" target="_blank">official site</a>. In addition, Spring framework contains some method to interact with RabbitMQ. More information about Spring with RabbitMQ can be found <a href="http://support.cloudfoundry.com/entries/20322602-getting-started-with-the-rabbitmq-service-from-a-spring-application" target="_blank">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hveiga.com/2012/06/how-to-installing-and-using-rabbitmq-in-ubuntu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ColdTrix Game Suite for MCF5272 in C</title>
		<link>http://www.hveiga.com/2012/06/coldtrix-game-suite-for-mcf5272-in-c/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=coldtrix-game-suite-for-mcf5272-in-c</link>
		<comments>http://www.hveiga.com/2012/06/coldtrix-game-suite-for-mcf5272-in-c/#comments</comments>
		<pubDate>Mon, 11 Jun 2012 00:55:58 +0000</pubDate>
		<dc:creator>hveiga</dc:creator>
				<category><![CDATA[Teleco]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[Coldfire]]></category>
		<category><![CDATA[Coldtrix]]></category>
		<category><![CDATA[etsit]]></category>
		<category><![CDATA[ETSIT-UPM]]></category>
		<category><![CDATA[LSED]]></category>
		<category><![CDATA[Lubeme]]></category>
		<category><![CDATA[Lubeme23]]></category>
		<category><![CDATA[MCF5272]]></category>
		<category><![CDATA[Motorolla]]></category>
		<category><![CDATA[teleco]]></category>
		<category><![CDATA[upm]]></category>

		<guid isPermaLink="false">http://www.hveiga.com/?p=156</guid>
		<description><![CDATA[Back in 2010, my colleague and friend Luis Úbeda ( @lubeme23 ) and me developed a video game suite for &#8216;Digital Systems Laboratory&#8217; (LSED) course in ETSIT-UPM. This course is based on creating a system (usually a game) using C &#8230; <a href="http://www.hveiga.com/2012/06/coldtrix-game-suite-for-mcf5272-in-c/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">Back in 2010, my colleague and friend Luis Úbeda ( <a href="http://twitter.com/#!/lubeme23" target="_blank">@lubeme23</a> ) and me developed a video game suite for &#8216;Digital Systems Laboratory&#8217; (LSED) course in ETSIT-UPM. This course is based on creating a system (usually a game) using C for MCF5272 microcontroller (AKA Motorolla Coldfire). The student has to create the appropiate hardware and software to achieve it.</p>
<p style="text-align: justify;">What we did? The basic assignment consisted in creating a similar game to the famous <a href="http://en.wikipedia.org/wiki/Tetris" target="_blank">Tetris</a>. We had to create a matrix of 8&#215;4 LEDs to use as the board and manage it  using Coldfire. Game was controlled using a usual 12-digit keyboard that was managed by the Coldfire as well. In addition to the basic assignment, we decided to improve the system: we developed the <a href="http://en.wikipedia.org/wiki/Snake_%28video_game%29" target="_blank">Snake</a> game for the same board, we put music to the games, we added a little LED matrix that showed you the next piece that was going to appear, added a voice read menu&#8230; Moreover, we tried to control the system using the PSP with infrared but we didn&#8217;t find out how to make it work in time (interruptions were behaving strangely!).</p>
<p style="text-align: justify;">After many hours of development we finished. That hard work was worth because we learnt a lot and we got Honors in that course <img src='http://www.hveiga.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
<p style="text-align: justify;">Now we have decided to publish the code under GPL license. Every comment and description is in Spanish. You can find it in Github: <a href="https://github.com/kec0/Coldtrix-Suite-Game" target="_blank">https://github.com/kec0/Coldtrix-Suite-Game</a></p>
<p>For ones who want to know the system deeper here it is the report of the system (also in Spanish): <a href="http://www.hveiga.com/2012/06/coldtrix-game-suite-for-mcf5272-in-c/coldtrixsuitegamereport_hectorveiga_luisubeda_2010/" rel="attachment wp-att-157">Coldtrix Suite Game Report</a></p>
<p>To sum up, this is a demo video we recorded:</p>
<p><strong>LSED (&#8216;Digital Systems Lab&#8217; course at ETSIT-UPM): Tetris &amp; Snake. Honors awarded.</strong></p>
<p style="text-align: center;"><iframe src="http://player.vimeo.com/video/42806167" frameborder="0" width="500" height="400"></iframe></p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hveiga.com/2012/06/coldtrix-game-suite-for-mcf5272-in-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>M-QAM Simulator in Matlab</title>
		<link>http://www.hveiga.com/2012/05/m-qam-simulator-in-matlab/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=m-qam-simulator-in-matlab</link>
		<comments>http://www.hveiga.com/2012/05/m-qam-simulator-in-matlab/#comments</comments>
		<pubDate>Sat, 26 May 2012 02:03:45 +0000</pubDate>
		<dc:creator>hveiga</dc:creator>
				<category><![CDATA[Teleco]]></category>
		<category><![CDATA[etsit]]></category>
		<category><![CDATA[LTDS]]></category>
		<category><![CDATA[Lubeme]]></category>
		<category><![CDATA[Lubeme23]]></category>
		<category><![CDATA[M-QAM]]></category>
		<category><![CDATA[Matlab]]></category>
		<category><![CDATA[QAM]]></category>
		<category><![CDATA[teleco]]></category>
		<category><![CDATA[upm]]></category>

		<guid isPermaLink="false">http://www.hveiga.com/?p=123</guid>
		<description><![CDATA[Like one year ago, my friend and colleague Luis Úbeda ( @lubeme23 ) and me developed a nice script in Matlab for simulating a telecommunication channel using M-QAM modulation. We have decided to release the code because we think It &#8230; <a href="http://www.hveiga.com/2012/05/m-qam-simulator-in-matlab/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">Like one year ago, my friend and colleague Luis Úbeda ( <a href="https://twitter.com/#!/lubeme23" target="_blank">@lubeme23</a> ) and me developed a nice script in Matlab for simulating a telecommunication channel using M-QAM modulation. We have decided to release the code because we think It can help people to better understand the digital <a href="http://en.wikipedia.org/wiki/Quadrature_amplitude_modulation" target="_blank">M-QAM modulation</a> when passing throung a noisy channel.</p>
<p style="text-align: justify;">How does it work? The script generates a random binary string of the desired length. Then it creates a QAM modulation with the entered level (4-QAM, 16-QAM, 64-QAM&#8230;). The scripts shows the constellation of the modulation. In the next step, it simulates the channel adding <a href="http://en.wikipedia.org/wiki/Additive_white_Gaussian_noise" target="_blank">additive white gaussian noise</a> to the signal, degrading the signal, according to the <a href="http://en.wikipedia.org/wiki/Signal-to-noise_ratio" target="_blank">SNR</a> selected. After that, it demodulates the QAM, shows the degraded constellation and checks how many bits have been corrupted. The result shows the <a href="http://en.wikipedia.org/wiki/Bit_error_rate" target="_blank">BER</a> produced in the experiment.</p>
<p style="text-align: justify;">There are 2 more scripts that allow you to compare between different M-QAM modulation and to select the appropiate modulation for a SNR given with a max BER.</p>
<p style="text-align: justify;">You can find the scripts in Github <a href="https://github.com/kec0/MQAM-Simulator" target="_blank">https://github.com/kec0/MQAM-Simulator</a> or you can download them all together in this zip file <a href="http://www.hveiga.com/2012/05/m-qam-simulator-in-matlab/mqam_simulator_matlab/" rel="attachment wp-att-125">MQAM Simulator Matlab</a>. There is a little pdf guide of how the algorithm is implemented inside the zip (it&#8217;s in spanish).</p>
<p style="text-align: justify;">As an example, here are some screenshots with one experiment. I have run <em>MQAM_Simulation(2000,3,0). </em>This means that I have 2000 random bits, i&#8217;m using 64-QAM and the SNR is 0. To begin with, it shows the 64-QAM constellation:</p>
<p style="text-align: center;"><a href="http://www.hveiga.com/2012/05/m-qam-simulator-in-matlab/before/" rel="attachment wp-att-128"><img class="aligncenter  wp-image-128" title="Constellation Before Transmission" src="http://www.hveiga.com/data/before-1024x640.jpg" alt="" width="574" height="358" /></a></p>
<p style="text-align: justify;">As we can see, every signal is perfectly placed. Now we make the signal traverse the noisy channel. This is how the constellation looks like:</p>
<p style="text-align: center;"><a href="http://www.hveiga.com/2012/05/m-qam-simulator-in-matlab/after/" rel="attachment wp-att-129"><img class="aligncenter  wp-image-129" title="Constellation After Passing Through Noisy Channel" src="http://www.hveiga.com/data/after-1024x640.jpg" alt="" width="574" height="358" /></a></p>
<p style="text-align: justify;">The effect of the AWG noise can be perfectly noticed. Then, the script represents a diagram with the input bits and the output ones where you can see that there are differences:</p>
<p style="text-align: center;"><a href="http://www.hveiga.com/2012/05/m-qam-simulator-in-matlab/diagrams/" rel="attachment wp-att-130"><img class="aligncenter  wp-image-130" title="MQAM Diagram" src="http://www.hveiga.com/data/diagrams-1024x640.jpg" alt="" width="574" height="358" /></a></p>
<p style="text-align: justify;">Finally, script returns the total number of corrupted bits and the BER:</p>
<p style="text-align: center;"><a href="http://www.hveiga.com/2012/05/m-qam-simulator-in-matlab/result/" rel="attachment wp-att-131"><img class="aligncenter  wp-image-131" title="MQAM Result" src="http://www.hveiga.com/data/result.jpg" alt="" width="667" height="131" /></a></p>
<p style="text-align: justify;">The script is able to use any M-QAM modulation from 4-QAM in advance. I hope it helps everyone to understand better how this type of digital modulation works. In addition, these scripts are under GPL License.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hveiga.com/2012/05/m-qam-simulator-in-matlab/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tecnicolor!</title>
		<link>http://www.hveiga.com/2012/05/tecnicolor/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=tecnicolor</link>
		<comments>http://www.hveiga.com/2012/05/tecnicolor/#comments</comments>
		<pubDate>Tue, 22 May 2012 22:09:15 +0000</pubDate>
		<dc:creator>hveiga</dc:creator>
				<category><![CDATA[Music]]></category>
		<category><![CDATA[indie]]></category>
		<category><![CDATA[music]]></category>
		<category><![CDATA[santacruz]]></category>
		<category><![CDATA[Supersubmarina]]></category>
		<category><![CDATA[tecnicolor]]></category>

		<guid isPermaLink="false">http://www.hveiga.com/?p=104</guid>
		<description><![CDATA[Cuando vuelvas otra vez,  puede que yo ya no esté Puede que ya me haya ido,  Y que no quiera más volver no me digas que no te avisé,  voy a desaparecer!! porque estoy así muy bien. Supersubmarina, Tecnicolor]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><iframe src="http://www.youtube.com/embed/L69fZ0UiCcs" frameborder="0" width="560" height="315"></iframe></p>
<p style="text-align: center;"><em>Cuando vuelvas otra vez, </em><br />
<em>puede que yo ya no esté</em><br />
<em>Puede que ya me haya ido, </em><br />
<em>Y que no quiera más volver</em><br />
<em>no me digas que no te avisé, </em><br />
<em>voy a desaparecer!!</em><br />
<em>porque estoy así muy bien.</em></p>
<p style="text-align: center;">Supersubmarina, Tecnicolor</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hveiga.com/2012/05/tecnicolor/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[HOW-TO] Auto-terminate an EC2 instance with Java</title>
		<link>http://www.hveiga.com/2012/05/how-to-auto-terminate-an-ec2-instance-with-java/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=how-to-auto-terminate-an-ec2-instance-with-java</link>
		<comments>http://www.hveiga.com/2012/05/how-to-auto-terminate-an-ec2-instance-with-java/#comments</comments>
		<pubDate>Tue, 22 May 2012 21:57:44 +0000</pubDate>
		<dc:creator>hveiga</dc:creator>
				<category><![CDATA[How-to]]></category>
		<category><![CDATA[Amazon]]></category>
		<category><![CDATA[AWS]]></category>
		<category><![CDATA[ec2]]></category>
		<category><![CDATA[instance]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[terminate]]></category>

		<guid isPermaLink="false">http://www.hveiga.com/?p=77</guid>
		<description><![CDATA[When we are doing different jobs in different instances, it is possible that we need to terminate an instance once the job is done. For this purpose we need to know the instance-id from within. Amazon provides a mechanism to &#8230; <a href="http://www.hveiga.com/2012/05/how-to-auto-terminate-an-ec2-instance-with-java/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>When we are doing different jobs in different instances, it is possible that we need to terminate an instance once the job is done. For this purpose we need to know the instance-id from within. Amazon provides a mechanism to get information about the instance itself: <a href="http://aws-musings.com/web-service-version-of-the-ec2-instance-metadata-query-tool/" target="_blank">http://aws-musings.com/web-service-version-of-the-ec2-instance-metadata-query-tool/</a></p>
<p>With this mechanism, we just need to call a process from Java to get the <em>instance-id</em> and run an TerminateInstancesRequest. I have created a static Java method to terminate an EC2 instance:</p>
<pre class="brush:java">public static void killMePlease() {

  try {
    String wget = "sudo wget -q -O - http://169.254.169.254/latest/meta-data/instance-id";
    Process p = Runtime.getRuntime().exec(wget);
    p.waitFor();
    BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));
    instanceId = br.readLine();
  } catch(Exception e) {
    e.printStackTrace();
  }

  if(instanceId.equals("")) return;

  List&lt;String&gt; instancesToTerminate = new ArrayList&lt;String&gt;();
  instancesToTerminate.add(instanceId);
  TerminateInstancesRequest terminateRequest = new TerminateInstancesRequest();
  terminateRequest.setInstanceIds(instancesToTerminate);
  ec2.terminateInstances(terminateRequest);
}</pre>
<p>I am not sure if there is other easier way to do it, but this code works. You can check the complete java code in my Github account: <a href="https://github.com/kec0/AWSKillInstance">https://github.com/kec0/AWSKillInstance</a></p>
<p>Thank you!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hveiga.com/2012/05/how-to-auto-terminate-an-ec2-instance-with-java/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[HOW-TO] Installing AWS SDK for PHP in Ubuntu 12.04</title>
		<link>http://www.hveiga.com/2012/05/how-to-installing-aws-sdk-for-php-in-ubuntu-12-04/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=how-to-installing-aws-sdk-for-php-in-ubuntu-12-04</link>
		<comments>http://www.hveiga.com/2012/05/how-to-installing-aws-sdk-for-php-in-ubuntu-12-04/#comments</comments>
		<pubDate>Mon, 14 May 2012 06:30:47 +0000</pubDate>
		<dc:creator>hveiga</dc:creator>
				<category><![CDATA[How-to]]></category>
		<category><![CDATA[Amazon]]></category>
		<category><![CDATA[AWS]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.hveiga.com/?p=26</guid>
		<description><![CDATA[This little guide is meant to help people to install and set up the Amazon Web Services SDK for PHP in few steps. I&#8217;m going to try to explain every single detail to help new people working with Amazon Web &#8230; <a href="http://www.hveiga.com/2012/05/how-to-installing-aws-sdk-for-php-in-ubuntu-12-04/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">This little guide is meant to help people to install and set up the Amazon Web Services SDK for PHP in few steps. I&#8217;m going to try to explain every single detail to help new people working with Amazon Web Services.</p>
<p style="text-align: justify;">To do so, I&#8217;m going to launch an Amazon EC2 instance with Ubuntu 12.04. To begin with we need to go the AWS Management Console, select the Amazon EC2 tab and click in &#8216;Launch instance&#8217;. We&#8217;ll follow &#8216;Classic Wizard&#8217; and click Continue. Now we have to select an Ubuntu 12.04 (Precise Pangolin) instance. Since it is going to be difficult to find it among all AMIs, the easiest way is to check the AMI identifier in the Ubuntu website: <a title="http://uec-images.ubuntu.com/releases/precise/release/" href="http://uec-images.ubuntu.com/releases/precise/release/" target="_blank">http://uec-images.ubuntu.com/releases/precise/release/</a> . For this guide I&#8217;m going to select this AMI: <strong>ami-ac9943c5</strong> (32-bit, ebs, us-east-1).</p>
<p style="text-align: justify;">To find by AMI ID we click in &#8216;Community AMIs&#8217; and we fill the Search field with the AMI ID we have selected. Something like this should appear:</p>
<p style="text-align: center;"><a href="http://www.hveiga.com/2012/05/how-to-installing-aws-sdk-for-php-in-ubuntu-12-04/selectingubuntu/" rel="attachment wp-att-28"><img class="aligncenter  wp-image-28" title="Selecting Ubuntu AMI" src="http://www.hveiga.com/data/selectingUbuntu.jpeg" alt="Selecting Ubuntu AMI" width="625" height="411" /></a></p>
<p style="text-align: justify;">We need to select the second one. In the next step we can select how many instances we want to launch and which type. For this example we will launch one <strong>t1.micro</strong> instance. Click continue. Click continue again. Give a name to the instance and click continue. Now you can select an existent keypair to connect to the instance or create a new one, it&#8217;s up to you. In the next window you have to select the security group for that instance (firewall). It is <strong>mandatory</strong> that the group allows SSH (port TCP 22) and HTTP (port TCP 80) connections at least, so if you need to create a new security group, do it with those rules. Click continue. Review all the parameters selected and if you are done click on Launch.</p>
<p style="text-align: justify;">Perfect! Now we have an Ubuntu 12.04 running over AWS. So let&#8217;s start with the installation and configuration of the AWS SDK for PHP. We need to connect to our instance. We are going to do it using SSH (directly from terminal if you are on Mac or Ubuntu, or via Putty or any similar program if you are on Windows). We are not using the terminal provided by the AWS Management Console. To connect using SSH we need the <strong>public</strong> DNS of our instance. We can get this URL in the instances list in the Amazon EC2 tab, just selecting our instance and checking the information below.</p>
<p style="text-align: center;"><a href="http://www.hveiga.com/2012/05/how-to-installing-aws-sdk-for-php-in-ubuntu-12-04/publicdns/" rel="attachment wp-att-35"><img class="aligncenter  wp-image-35" title="Public DNS of instance" src="http://www.hveiga.com/data/publicDNS.jpg" alt="Public DNS of instance" width="748" height="216" /></a></p>
<p>It should be similar to: <strong>ec2-107-21-164-34.compute-1.amazonaws.com. </strong>Let&#8217;s open a Terminal (or Putty) and browse to the folder where we have our keypair. Once there, we execute:</p>
<pre>ssh -i keypair_name.pem username@public_dns</pre>
<p>For my example, mine would be:</p>
<pre>ssh -i myKeypair.pem ubuntu@ec2-107-21-164-34.compute-1.amazonaws.com</pre>
<p>If everything is right, you will connect to the instance. However, not everything works at the first time.  If you cannot connect, the most common issues are:</p>
<ul>
<li>Keypair permissions: the .pem file must have a specific permissions to be used. Those are that just the owner can read and write. So set them accordingly. If you are using Ubuntu or Mac execute: chmod 600 keypair.pem</li>
<li>Security group port closed: ensure that your security group allows SSH connections (port TCP 22).</li>
</ul>
<div><a href="http://www.hveiga.com/2012/05/how-to-installing-aws-sdk-for-php-in-ubuntu-12-04/connected/" rel="attachment wp-att-47"><img class="aligncenter  wp-image-47" title="Connected" src="http://www.hveiga.com/data/connected-1024x640.png" alt="Connected" width="717" height="448" /></a></div>
<p>Once you are connected, you are in a completely new and clear Ubuntu. So, we need to install the following:</p>
<ul>
<li>Apache: it&#8217;s the webserver, needed to run PHP scripts.</li>
<li>PHP5: the engine of PHP.</li>
<li>Curl for PHP: a tool for transferring files that is used by the AWS SDK for PHP.</li>
<li>Pear: a PHP application repository.</li>
<li>AWSSDKforPHP: the SDK itself.</li>
</ul>
<p>First of all, we should update the package list:</p>
<pre>sudo apt-get update</pre>
<p>And now let&#8217;s install what we need:</p>
<pre>sudo apt-get install apache2</pre>
<pre>sudo apt-get install php5</pre>
<pre>sudo apt-get install php5-curl</pre>
<pre>sudo apt-get install php-pear</pre>
<pre>sudo /etc/init.d/apache2 restart</pre>
<p style="text-align: justify;">Everything, except the SDK, should be installed right now. Let&#8217;s test it. Browse to /var/www . Remove the file index.html (<em>sudo rm index.html</em>) and run <em>sudo pico index.php </em>. Pico or nano is a terminal text editor. Write &#8216;<em>&lt;?php phpinfo(); ?&gt;&#8217;</em>  and press Ctrl + X, then Y, and press Enter. Now if we go to http://ec2-107-21-164-34.compute-1.amazonaws.com (your public DNS address) in any browser we should see this:</p>
<p style="text-align: center;"><a href="http://www.hveiga.com/2012/05/how-to-installing-aws-sdk-for-php-in-ubuntu-12-04/itworks/" rel="attachment wp-att-48"><img class="aligncenter  wp-image-48" title="PHP Installed" src="http://www.hveiga.com/data/itworks-1024x640.png" alt="PHP Installed" width="717" height="448" /></a></p>
<p style="text-align: justify;">Nice! We are almost done. Let&#8217;s install and configure the SDK. We are going to do it using PEAR ( <a href="http://pear.amazonwebservices.com/">http://pear.amazonwebservices.com/</a> ), so let&#8217;s run:</p>
<pre>sudo pear channel-discover pear.amazonwebservices.com</pre>
<pre>sudo pear install aws/sdk</pre>
<p style="text-align: justify;">Installation done. Let&#8217;s configure it. Navigate to /usr/share/php/AWSSDKforPHP . Once there, run <em>sudo pico config-sample.inc.php</em> . This file contains all the information to connect with Amazon when you are doing requests. You need to fill up key (that it&#8217;s also called public key) and secret key. You can get them from <a href="https://aws-portal.amazon.com/gp/aws/securityCredentials">https://aws-portal.amazon.com/gp/aws/securityCredentials</a>. When you are done, press Ctrl + X, press Y, and now rename the file to <em>config.inc.php</em> and press Enter and Y. Last step is to test if the SDK works. The SDK comes with some test files, so let&#8217;s use them! Without changing the directory, execute:</p>
<pre>sudo cp -r _samples /var/www</pre>
<pre>sudo /etc/init.d/apache2 restart</pre>
<p style="text-align: justify;">Now navigate to /var/www/_samples/ and execute <em>sudo pico cli-s3_get_urls_for_uplods.php</em> and replace &#8220;require_once &#8216;../sdk.class.php&#8217;;&#8221; for &#8220;require_once &#8216;AWSSDKforPHP/sdk.class.php&#8217;;&#8221; . Finally, go to any browser and go to: http://ec2-107-21-164-34.compute-1.amazonaws.com/_samples/cli-s3_get_urls_for_uploads.php (using your public DNS address) and we should see:</p>
<p style="text-align: center;"><a href="http://www.hveiga.com/2012/05/how-to-installing-aws-sdk-for-php-in-ubuntu-12-04/pantallazo/" rel="attachment wp-att-44"><img class="aligncenter  wp-image-44" title="Success Screen" src="http://www.hveiga.com/data/Pantallazo-1024x640.png" alt="Success Screen" width="717" height="448" /></a></p>
<p style="text-align: justify;">Congratulations! You have installed successfully the AWS SDK for PHP in Ubuntu 12.04. Now you have uploaded 4 test files to a bucket in your S3 account, go check it! Each time you want to use the SDK you just need to add  &#8221;require_once &#8216;AWSSDKforPHP/sdk.class.php&#8217;;&#8221; in your PHP code. I hope this guide helps people with installation and configuration problems. If you have any doubts, comment!</p>
<p>Héctor.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hveiga.com/2012/05/how-to-installing-aws-sdk-for-php-in-ubuntu-12-04/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HTC Contest: The Tomorrow Talks</title>
		<link>http://www.hveiga.com/2012/05/htc-contest-the-tomorrow-talks/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=htc-contest-the-tomorrow-talks</link>
		<comments>http://www.hveiga.com/2012/05/htc-contest-the-tomorrow-talks/#comments</comments>
		<pubDate>Mon, 14 May 2012 02:47:26 +0000</pubDate>
		<dc:creator>hveiga</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[etsit]]></category>
		<category><![CDATA[flow concept]]></category>
		<category><![CDATA[htc]]></category>
		<category><![CDATA[upm]]></category>

		<guid isPermaLink="false">http://www.hveiga.com/?p=20</guid>
		<description><![CDATA[Me cuentan desde la ETSIT-UPM que HTC ha organizado un concurso para presentar nuevos modelos de teléfonos móviles. Si no estoy mal informado, los ganadores viajarán a donde elijan. Estoy orgulloso de presentaros el prototipo de mis compañeros de teleco &#8230; <a href="http://www.hveiga.com/2012/05/htc-contest-the-tomorrow-talks/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Me cuentan desde la ETSIT-UPM que HTC ha organizado un concurso para presentar nuevos modelos de teléfonos móviles. Si no estoy mal informado, los ganadores viajarán a donde elijan. Estoy orgulloso de presentaros el prototipo de mis compañeros de teleco (Ignacio Suárez, Miguel Álvarez, Ignacio Bermejo, Luis Rivero y Mario Sánchez): <strong>Flow Concept</strong>.</p>
<p>Echadle un ojo, no tiene desperdicio. Link al video: <strong><a title="Flow Concept" href="http://www.thetomorrowtalks.com/videos/details/2189?fb_ref=.T6mQTnf5Sx4.like&amp;fb_source=timeline " target="_blank">Flow Concept</a></strong></p>
<p>Espero que ganéis cracks <img src='http://www.hveiga.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
<p>&nbsp;</p>
<p>Para más información sobre  el concurso: <a title="The Tomorrow Talks" href="http://www.thetomorrowtalks.com/" target="_blank">http://www.thetomorrowtalks.com/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.hveiga.com/2012/05/htc-contest-the-tomorrow-talks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hermética</title>
		<link>http://www.hveiga.com/2012/05/hermetica/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=hermetica</link>
		<comments>http://www.hveiga.com/2012/05/hermetica/#comments</comments>
		<pubDate>Mon, 14 May 2012 00:31:41 +0000</pubDate>
		<dc:creator>hveiga</dc:creator>
				<category><![CDATA[Music]]></category>

		<guid isPermaLink="false">http://www.hveiga.com/?p=13</guid>
		<description><![CDATA[Esperando al 22 de Mayo: SantaCruz.]]></description>
			<content:encoded><![CDATA[<p>Esperando al 22 de Mayo: SantaCruz.</p>
<p><iframe src="http://www.youtube.com/embed/51Lo_iiroQE" frameborder="0" width="480" height="360"></iframe></p>
]]></content:encoded>
			<wfw:commentRss>http://www.hveiga.com/2012/05/hermetica/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
