<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-7703764077976468648</id><updated>2024-08-31T14:36:40.789+01:00</updated><category term="Apache"/><category term="HttpClient"/><category term="Kafka"/><category term="SSL"/><category term="dbunit"/><category term="flatxmldataset"/><category term="mysql"/><title type='text'>Octavio Martin</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://octaviomartin.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7703764077976468648/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://octaviomartin.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/7703764077976468648/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>martoc</name><uri>http://www.blogger.com/profile/07450494412582567682</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>37</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7703764077976468648.post-4813775011532839609</id><published>2017-06-07T10:34:00.003+01:00</published><updated>2017-06-07T10:34:52.723+01:00</updated><title type='text'>Setting up consul and unbound</title><content type='html'>Create this file at /etc/unbound/local.d/consul.conf
&lt;pre class=&quot;prettyprint&quot;&gt;
do-not-query-localhost: no
stub-zone:
  name: &quot;consul&quot;
  stub-addr: 127.0.0.1@8600
server:
  domain-insecure: &quot;consul&quot;
&lt;/pre&gt;
Update /etc/resolv.conf
&lt;pre class=&quot;prettyprint&quot;&gt;
nameserver 127.0.0.1
&lt;/pre&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7703764077976468648/posts/default/4813775011532839609'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7703764077976468648/posts/default/4813775011532839609'/><link rel='alternate' type='text/html' href='http://octaviomartin.blogspot.com/2017/06/setting-up-consul-and-unbound.html' title='Setting up consul and unbound'/><author><name>martoc</name><uri>http://www.blogger.com/profile/07450494412582567682</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-7703764077976468648.post-5431688951363473462</id><published>2016-09-29T11:36:00.003+01:00</published><updated>2016-09-29T11:36:40.963+01:00</updated><title type='text'>Find the biggest file in a directory and sub-directories</title><content type='html'>&lt;pre class=&quot;prettyprint&quot;&gt;
$find . -type f -printf &quot;%s\t%p\n&quot; | sort -n | tail -1
&lt;/pre&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7703764077976468648/posts/default/5431688951363473462'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7703764077976468648/posts/default/5431688951363473462'/><link rel='alternate' type='text/html' href='http://octaviomartin.blogspot.com/2016/09/find-biggest-file-in-directory-and-sub.html' title='Find the biggest file in a directory and sub-directories'/><author><name>martoc</name><uri>http://www.blogger.com/profile/07450494412582567682</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-7703764077976468648.post-8450611038951780389</id><published>2015-09-03T12:32:00.003+01:00</published><updated>2015-09-03T12:33:42.295+01:00</updated><title type='text'>Spring upgrade from 3.1.4.RELEASE to 4.1.4.RELEASE</title><content type='html'>&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Upgrade to Spring Security 3.2.5.RELEASE&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;li&gt;Replace legacy XMLs&lt;/li&gt;
&lt;/ul&gt;
&lt;blockquote&gt;
From:
&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;&amp;lt;list&amp;gt;
  &amp;lt;ref local=&quot;objectName&quot;/&amp;gt;
&amp;lt;/list&amp;gt;
&lt;/pre&gt;
&lt;br /&gt;
To:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;&amp;lt;list&amp;gt;
  &amp;lt;ref bean=&quot;objectName&quot;/&amp;gt;
&amp;lt;/list&amp;gt;
&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Remove spring-asm has been included into spring-core, any dependency has been removed see release notes for 3.2 at &lt;a href=&quot;http://spring.io/blog/2012/09/12/spring-framework-3-2-m2-released&quot;&gt;http://spring.io/blog/2012/09/12/spring-framework-3-2-m2-released&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;li&gt;Upgrade spring security version schema from 3.1 to 3.2&lt;/li&gt;
&lt;/ul&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7703764077976468648/posts/default/8450611038951780389'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7703764077976468648/posts/default/8450611038951780389'/><link rel='alternate' type='text/html' href='http://octaviomartin.blogspot.com/2015/09/spring-upgrade-from-314release-to.html' title='Spring upgrade from 3.1.4.RELEASE to 4.1.4.RELEASE'/><author><name>martoc</name><uri>http://www.blogger.com/profile/07450494412582567682</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-7703764077976468648.post-3932897080157375189</id><published>2015-05-26T17:38:00.003+01:00</published><updated>2015-06-03T16:11:47.382+01:00</updated><title type='text'>Checking tomcat version</title><content type='html'>&lt;pre class=&quot;prettyprint&quot;&gt;
$ java -cp CATALINA_BASE/lib/catalina.jar org.apache.catalina.util.ServerInfo
&lt;/pre&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7703764077976468648/posts/default/3932897080157375189'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7703764077976468648/posts/default/3932897080157375189'/><link rel='alternate' type='text/html' href='http://octaviomartin.blogspot.com/2015/05/checking-tomcat-version.html' title='Checking tomcat version'/><author><name>martoc</name><uri>http://www.blogger.com/profile/07450494412582567682</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-7703764077976468648.post-8394558259786874305</id><published>2015-02-04T18:57:00.003+00:00</published><updated>2015-02-04T19:03:39.790+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Apache"/><category scheme="http://www.blogger.com/atom/ns#" term="Kafka"/><title type='text'>Sending a test message to a Kafka cluster</title><content type='html'>&lt;pre class=&quot;prettyprint&quot;&gt;
$ /usr/local/Cellar/kafka/0.8.1.1/bin/kafka-producer-perf-test.sh --broker-list localhost:9092 --topic &lt;TOPIC_NAME&gt; --messages 1 --producer-num-retries 1
&lt;/pre&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7703764077976468648/posts/default/8394558259786874305'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7703764077976468648/posts/default/8394558259786874305'/><link rel='alternate' type='text/html' href='http://octaviomartin.blogspot.com/2015/02/sending-test-message-to-kafka-queue.html' title='Sending a test message to a Kafka cluster'/><author><name>martoc</name><uri>http://www.blogger.com/profile/07450494412582567682</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-7703764077976468648.post-2898585554475341838</id><published>2014-09-05T13:46:00.000+01:00</published><updated>2014-09-05T13:46:26.187+01:00</updated><title type='text'>Git merge replacing local changes with &#39;theirs&#39;</title><content type='html'>&lt;pre class=&quot;prettyprint&quot;&gt;
$ git merge -s recursive -Xtheirs &amp;lt;branch_name&amp;gt;
&lt;/pre&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7703764077976468648/posts/default/2898585554475341838'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7703764077976468648/posts/default/2898585554475341838'/><link rel='alternate' type='text/html' href='http://octaviomartin.blogspot.com/2014/09/git-merge-replacing-local-changes-with.html' title='Git merge replacing local changes with &#39;theirs&#39;'/><author><name>martoc</name><uri>http://www.blogger.com/profile/07450494412582567682</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-7703764077976468648.post-4698533208761343163</id><published>2014-08-27T17:22:00.001+01:00</published><updated>2014-11-18T10:22:44.754+00:00</updated><title type='text'>Setting up a MongoDB replica set</title><content type='html'>&lt;ul&gt;
&lt;li&gt;All nodes have to be started with this flag --replSet &quot;clusterName&quot;&lt;/li&gt;
&lt;li&gt;In one of the nodes, execute the following commands
&lt;pre class=&quot;prettyprint&quot;&gt;
$ mongo
&gt; rs.initiate()
&gt; rs.add(&quot;hostname1&quot;)
&gt; rs.add(&quot;hostname2&quot;)
&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;
This command will allow you to execute queries in a slave node
&lt;pre class=&quot;prettyprint&quot;&gt;
&gt; rs.slaveOk()
&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;
This command will show you the status of the cluster
&lt;pre class=&quot;prettyprint&quot;&gt;
&gt; rs.status() 
&lt;/pre&gt;
&lt;/li&gt;
&lt;/ul&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7703764077976468648/posts/default/4698533208761343163'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7703764077976468648/posts/default/4698533208761343163'/><link rel='alternate' type='text/html' href='http://octaviomartin.blogspot.com/2014/08/setting-up-mongodb-replica-set.html' title='Setting up a MongoDB replica set'/><author><name>martoc</name><uri>http://www.blogger.com/profile/07450494412582567682</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-7703764077976468648.post-1614327378753577134</id><published>2014-07-07T13:39:00.000+01:00</published><updated>2014-07-07T13:39:01.208+01:00</updated><title type='text'>Adding custom implementations to mock objects</title><content type='html'>It shows how to add customs implementations to a mocked class using Mockito framework, this particularly example shows implementations for setAttribute and getAttribute methods of the class javax.serlvet.HttpSession&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;   
    doAnswer(new Answer&amp;lt;Object&amp;gt;() {
      @Override
      public Object answer(InvocationOnMock invocation) throws Throwable {
        return sessionHolder.put((String) invocation.getArguments()[0],
            (String) invocation.getArguments()[1]);
      }
    }).when(session).setAttribute(anyString(), anyObject());
    when(session.getAttribute(anyString())).then(new Answer&amp;lt;String&amp;gt;() {
      @Override
      public String answer(InvocationOnMock invocation) throws Throwable {
        return sessionHolder.get(invocation.getArguments()[0]);
      }
    });
&lt;/pre&gt;
</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7703764077976468648/posts/default/1614327378753577134'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7703764077976468648/posts/default/1614327378753577134'/><link rel='alternate' type='text/html' href='http://octaviomartin.blogspot.com/2014/07/adding-custom-implementations-to-mock.html' title='Adding custom implementations to mock objects'/><author><name>martoc</name><uri>http://www.blogger.com/profile/07450494412582567682</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-7703764077976468648.post-7754573366446332276</id><published>2014-06-03T15:00:00.000+01:00</published><updated>2014-06-03T15:01:17.982+01:00</updated><title type='text'>Download RPMs from a YUM repo</title><content type='html'>Install yumdownloader
&lt;pre class=&quot;prettyprint&quot;&gt;
$ yum install yum-utils
&lt;/pre&gt;

Get all installed packages
&lt;pre class=&quot;prettyprint&quot;&gt;
$ rpm -qa
&lt;/pre&gt;

Get your package
&lt;pre class=&quot;prettyprint&quot;&gt;
$ yumdownloader &amp;lt;package_name&amp;gt;
&lt;/pre&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7703764077976468648/posts/default/7754573366446332276'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7703764077976468648/posts/default/7754573366446332276'/><link rel='alternate' type='text/html' href='http://octaviomartin.blogspot.com/2014/06/download-rpms-from-yum-repo.html' title='Download RPMs from a YUM repo'/><author><name>martoc</name><uri>http://www.blogger.com/profile/07450494412582567682</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-7703764077976468648.post-3183799651712272303</id><published>2013-11-27T11:25:00.001+00:00</published><updated>2013-11-27T11:25:45.041+00:00</updated><title type='text'>RabbitMQ useful commands</title><content type='html'>Get status of the broker
&lt;pre class=&quot;prettyprint&quot;&gt;
$ &amp;lt;RABBIT_HOME&amp;gt;/sbin/rabbitmqctl status
&lt;/pre&gt;

Get list of bindings
&lt;pre class=&quot;prettyprint&quot;&gt;
$ &amp;lt;RABBIT_HOME&amp;gt;/sbin/rabbitmqctl list_bindings
&lt;/pre&gt;

Get list of exchanges
&lt;pre class=&quot;prettyprint&quot;&gt;
$ &amp;lt;RABBIT_HOME&amp;gt;/sbin/rabbitmqctl list_exchanges
&lt;/pre&gt;

Stop the broker
&lt;pre class=&quot;prettyprint&quot;&gt;
$ &amp;lt;RABBIT_HOME&amp;gt;/sbin/rabbitmqctl stop
&lt;/pre&gt;

Start the broker
&lt;pre class=&quot;prettyprint&quot;&gt;
$ &amp;lt;RABBIT_HOME&amp;gt;/sbin/rabbitmq-server 
&lt;/pre&gt;

List of available plugins
&lt;pre class=&quot;prettyprint&quot;&gt;
$ &amp;lt;RABBIT_HOME&amp;gt;/sbin/rabbitmq-plugins list
&lt;/pre&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7703764077976468648/posts/default/3183799651712272303'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7703764077976468648/posts/default/3183799651712272303'/><link rel='alternate' type='text/html' href='http://octaviomartin.blogspot.com/2013/11/rabbitmq-useful-commands.html' title='RabbitMQ useful commands'/><author><name>martoc</name><uri>http://www.blogger.com/profile/07450494412582567682</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-7703764077976468648.post-5453096434149443655</id><published>2013-11-03T22:53:00.000+00:00</published><updated>2013-11-03T22:53:01.198+00:00</updated><title type='text'>Convert an .icns to .png</title><content type='html'>&lt;pre class=&quot;prettyprint&quot;&gt;
$ sips -s format png padlock.icns --out padlock.png
&lt;/pre&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7703764077976468648/posts/default/5453096434149443655'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7703764077976468648/posts/default/5453096434149443655'/><link rel='alternate' type='text/html' href='http://octaviomartin.blogspot.com/2013/11/convert-icns-to-png.html' title='Convert an .icns to .png'/><author><name>martoc</name><uri>http://www.blogger.com/profile/07450494412582567682</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-7703764077976468648.post-436763228281323815</id><published>2013-10-10T11:33:00.001+01:00</published><updated>2013-10-12T10:56:02.416+01:00</updated><title type='text'>Improving Java debugger hotswap</title><content type='html'>These days, I have been fixing bugs in an application which runs onto an application server. I have found that these flags can improve the JVM HotSwap, basically, increasing the space where the classes are loaded with MaxPermSize and allowing the garbage collector to unload classes from this space, will improve the success rate doing hotswap. The third parameter is needed to activate this flag CMSClassUnloadingEnable.
&lt;pre class=&quot;prettyprint&quot;&gt;
-XX:MaxPermSize=1024m -XX:+CMSClassUnloadingEnabled -XX:+UseConcMarkSweepGC
&lt;/pre&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7703764077976468648/posts/default/436763228281323815'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7703764077976468648/posts/default/436763228281323815'/><link rel='alternate' type='text/html' href='http://octaviomartin.blogspot.com/2013/10/improving-hotswap-using-java-debugger.html' title='Improving Java debugger hotswap'/><author><name>martoc</name><uri>http://www.blogger.com/profile/07450494412582567682</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-7703764077976468648.post-1727020910402772934</id><published>2013-10-02T11:06:00.001+01:00</published><updated>2013-10-02T11:06:45.147+01:00</updated><title type='text'>Checking memory values in Linux</title><content type='html'>&lt;pre class=&quot;prettyprint&quot;&gt;

$ cat /proc/meminfo

MemTotal:       16269604 kB
MemFree:        13524376 kB
Buffers:          243792 kB
Cached:          1956980 kB
SwapCached:            0 kB
Active:          1077452 kB
Inactive:        1251652 kB
Active(anon):     128672 kB
Inactive(anon):     6076 kB
Active(file):     948780 kB
Inactive(file):  1245576 kB
Unevictable:           0 kB
Mlocked:               0 kB
SwapTotal:       4194288 kB
SwapFree:        4194288 kB
Dirty:                28 kB
Writeback:             0 kB
AnonPages:        128320 kB
Mapped:            40720 kB
Shmem:              6440 kB
Slab:             295108 kB
SReclaimable:     267904 kB
SUnreclaim:        27204 kB
KernelStack:        1672 kB
PageTables:         5480 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:    12329088 kB
Committed_AS:     448724 kB
VmallocTotal:   34359738367 kB
VmallocUsed:       39884 kB
VmallocChunk:   34359688892 kB
HardwareCorrupted:     0 kB
AnonHugePages:         0 kB
HugePages_Total:       0
HugePages_Free:        0
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:       2048 kB
DirectMap4k:    16777216 kB
DirectMap2M:           0 kB
&lt;/pre&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7703764077976468648/posts/default/1727020910402772934'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7703764077976468648/posts/default/1727020910402772934'/><link rel='alternate' type='text/html' href='http://octaviomartin.blogspot.com/2013/10/checking-memory-values-in-linux.html' title='Checking memory values in Linux'/><author><name>martoc</name><uri>http://www.blogger.com/profile/07450494412582567682</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-7703764077976468648.post-4356405274832809300</id><published>2013-10-01T11:12:00.002+01:00</published><updated>2013-10-01T11:12:32.224+01:00</updated><title type='text'>Recording and sending http requests using mitmproxy and mitmdump</title><content type='html'>&lt;ul&gt;
&lt;li&gt;Start mitmproxy
&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;$ mitmproxy -p 4444 -w localhost.requests
&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;
Set up your internal web proxy, on Mac OS this can be set up in the System Preferences application. Network &amp;gt; Advanced &amp;gt; Proxies &amp;gt; Web Proxy (HTTP), Your proxy must use localhost:4444
&lt;/li&gt;
&lt;li&gt;Now you are able to use your browser to record your requests&lt;/li&gt;
&lt;li&gt;Using this command the recorded requests can be resent&lt;/li&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;$ mitmdump -nc localhost.requests&lt;/pre&gt;
&lt;li&gt;I had problems executing the last command in parallel in the same machine, I sorted this out choosing different ports, so it could run in parallel, the following script executes 100 instances of mitmdump&lt;/li&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;#! /bin/sh

max=100
for i in `seq 1 $max`
do
    echo &quot;$i&quot;
    port=$((i + 9000))
    mitmdump -c localhost.requests -p $port &amp;amp;
done
&lt;/pre&gt;
&lt;/ul&gt;
</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7703764077976468648/posts/default/4356405274832809300'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7703764077976468648/posts/default/4356405274832809300'/><link rel='alternate' type='text/html' href='http://octaviomartin.blogspot.com/2013/10/recording-and-sending-http-requests.html' title='Recording and sending http requests using mitmproxy and mitmdump'/><author><name>martoc</name><uri>http://www.blogger.com/profile/07450494412582567682</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-7703764077976468648.post-7524944028181395274</id><published>2013-09-18T16:20:00.000+01:00</published><updated>2013-10-01T10:51:12.065+01:00</updated><title type='text'>Counting the number of occurrences in a file</title><content type='html'>&lt;pre class=&quot;prettyprint&quot;&gt;
$ cat file.log | grep java.lang.NullPointerException | wc -l
&lt;/pre&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7703764077976468648/posts/default/7524944028181395274'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7703764077976468648/posts/default/7524944028181395274'/><link rel='alternate' type='text/html' href='http://octaviomartin.blogspot.com/2013/09/count-number-of-occurrences-in-file.html' title='Counting the number of occurrences in a file'/><author><name>martoc</name><uri>http://www.blogger.com/profile/07450494412582567682</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-7703764077976468648.post-6007781631830428429</id><published>2013-08-31T12:17:00.001+01:00</published><updated>2013-09-07T10:37:35.353+01:00</updated><title type='text'>Turning on/off a VirtualBox virtual machine</title><content type='html'>&lt;ul&gt;
&lt;li&gt;Starting&lt;/li&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;$ VBoxManage startvm devops-server --type headless
&lt;/pre&gt;
&lt;li&gt;Stoping&lt;/li&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;$ VBoxManage controlvm devops-server poweroff
&lt;/pre&gt;
&lt;/ul&gt;
</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7703764077976468648/posts/default/6007781631830428429'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7703764077976468648/posts/default/6007781631830428429'/><link rel='alternate' type='text/html' href='http://octaviomartin.blogspot.com/2013/08/turning-onoff-virtualbox-virtual-machine.html' title='Turning on/off a VirtualBox virtual machine'/><author><name>martoc</name><uri>http://www.blogger.com/profile/07450494412582567682</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-7703764077976468648.post-6889329643138589054</id><published>2013-08-31T12:13:00.000+01:00</published><updated>2013-08-31T12:13:50.431+01:00</updated><title type='text'>Setting up a static IP address in Ubuntu server</title><content type='html'>&lt;ul&gt;
&lt;li&gt;Configuration file&amp;nbsp;&lt;/li&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;
$ sudo vi /etc/network/interfaces
&lt;/pre&gt;
&lt;li&gt;DHCP&lt;/li&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;auto eth0
iface eth0 inet dhcp
&lt;/pre&gt;
&lt;li&gt;Static IP&lt;/li&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;auto eth0
iface eth0 inet static
      address 192.168.1.100
      netmask 255.255.255.0
      network 192.168.1.0
      broadcast 192.168.1.255
      gateway 192.168.1.1
&lt;/pre&gt;
&lt;/ul&gt;
</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7703764077976468648/posts/default/6889329643138589054'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7703764077976468648/posts/default/6889329643138589054'/><link rel='alternate' type='text/html' href='http://octaviomartin.blogspot.com/2013/08/setting-up-static-ip-address-in-ubuntu.html' title='Setting up a static IP address in Ubuntu server'/><author><name>martoc</name><uri>http://www.blogger.com/profile/07450494412582567682</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-7703764077976468648.post-5557997302793498946</id><published>2013-05-06T20:47:00.001+01:00</published><updated>2013-05-06T20:48:10.125+01:00</updated><title type='text'>Setting up an apache account in Mountain Lion</title><content type='html'>&lt;ul&gt;
&lt;li&gt;Create this file&lt;/li&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;$ vi /etc/apache2/users/username.conf
&lt;/pre&gt;
&lt;li&gt;Add this content&lt;/li&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;LoadModule php5_module libexec/apache2/libphp5.so

&amp;lt;Directory &quot;/Users/username/Sites/&quot;&amp;gt;
    Options Indexes MultiViews
    AllowOverride None
    Order allow,deny
    Allow from all
&amp;lt;/Directory&amp;gt;
&lt;/pre&gt;

&lt;li&gt;Start Apache&lt;/li&gt;

&lt;pre class=&quot;prettyprint&quot;&gt;
sudo launchctl load -w /System/Library/LaunchDaemons/org.apache.httpd.plist
&lt;/pre&gt;

&lt;/ul&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7703764077976468648/posts/default/5557997302793498946'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7703764077976468648/posts/default/5557997302793498946'/><link rel='alternate' type='text/html' href='http://octaviomartin.blogspot.com/2013/05/setting-up-apache-account-in-mountain.html' title='Setting up an apache account in Mountain Lion'/><author><name>martoc</name><uri>http://www.blogger.com/profile/07450494412582567682</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-7703764077976468648.post-3152246486279689272</id><published>2013-05-03T12:49:00.002+01:00</published><updated>2013-05-03T13:13:53.514+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Apache"/><category scheme="http://www.blogger.com/atom/ns#" term="HttpClient"/><category scheme="http://www.blogger.com/atom/ns#" term="SSL"/><title type='text'>Setting up a trust strategy for Apache HTTPClient 4.2</title><content type='html'>&lt;pre class=&quot;prettyprint&quot; style=&quot;overflow: auto;&quot;&gt;SSLSocketFactory sslsf = new SSLSocketFactory(new TrustStrategy() {
  public boolean isTrusted(final X509Certificate[] chain,String authType) 
            throws CertificateException {
    return true;
  }
});

SchemeRegistry schemeRegistry = new SchemeRegistry();
schemeRegistry.register(new Scheme(&quot;https&quot;, 443, sslsf));
schemeRegistry.register(new Scheme(&quot;http&quot;, 80, PlainSocketFactory.getSocketFactory()));
// apache HttpClient version &amp;gt;4.2 should use
// BasicClientConnectionManager
ClientConnectionManager cm = new SingleClientConnManager(schemeRegistry);
DefaultHttpClient httpclient = new DefaultHttpClient(cm);
&lt;/pre&gt;
</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7703764077976468648/posts/default/3152246486279689272'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7703764077976468648/posts/default/3152246486279689272'/><link rel='alternate' type='text/html' href='http://octaviomartin.blogspot.com/2013/05/setting-up-trust-strategy-for-apache.html' title='Setting up a trust strategy for Apache HTTPClient 4.2'/><author><name>martoc</name><uri>http://www.blogger.com/profile/07450494412582567682</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><georss:featurename>London, UK</georss:featurename><georss:point>51.511213899999987 -0.11982439999997041</georss:point><georss:box>51.195090399999984 -0.7652713999999704 51.82733739999999 0.52562260000002958</georss:box></entry><entry><id>tag:blogger.com,1999:blog-7703764077976468648.post-7041713089427815000</id><published>2013-04-09T16:41:00.001+01:00</published><updated>2013-04-16T19:54:45.559+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="dbunit"/><category scheme="http://www.blogger.com/atom/ns#" term="flatxmldataset"/><category scheme="http://www.blogger.com/atom/ns#" term="mysql"/><title type='text'>Exporting MySql tables to DBUnit FlatXmlDataSet format</title><content type='html'>This fragment of code allows export a table to the DBUnit Flat XML format

&lt;pre class=&quot;prettyprint&quot; style=&quot;overflow: auto;&quot;&gt;
Class.forName(&quot;org.gjt.mm.mysql.Driver&quot;);
Connection jdbcConnection = DriverManager.getConnection(&quot;jdbc:mysql://localhost:3306/database_name?zeroDateTimeBehavior=convertToNull&quot;,&quot;user&quot;, &quot;password&quot;);
IDatabaseConnection connection = new DatabaseConnection(jdbcConnection);
QueryDataSet partialDataSet = new QueryDataSet(connection);
partialDataSet.addTable(&quot;table_name&quot;);
FlatXmlDataSet.write(partialDataSet,new FileOutputStream(&quot;partial.xml&quot;));
&lt;/pre&gt;

</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7703764077976468648/posts/default/7041713089427815000'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7703764077976468648/posts/default/7041713089427815000'/><link rel='alternate' type='text/html' href='http://octaviomartin.blogspot.com/2013/04/export-table-from-mysql-to-dbunit.html' title='Exporting MySql tables to DBUnit FlatXmlDataSet format'/><author><name>martoc</name><uri>http://www.blogger.com/profile/07450494412582567682</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><georss:featurename>London, UK</georss:featurename><georss:point>51.511213899999987 -0.11982439999997041</georss:point><georss:box>51.195107899999989 -0.7652713999999704 51.827319899999985 0.52562260000002958</georss:box></entry><entry><id>tag:blogger.com,1999:blog-7703764077976468648.post-3150121456572594128</id><published>2013-04-05T16:18:00.000+01:00</published><updated>2015-06-03T16:13:20.669+01:00</updated><title type='text'>Partially mocking a class, mixing mock and real implementation</title><content type='html'>&lt;div&gt;
In this particular case, I tried to test a servlet but I needed mock an inherited internal method &lt;i&gt;&lt;b&gt;getServletContext() &lt;/b&gt;&lt;/i&gt;, Thus &lt;b&gt;&lt;i&gt;spy(T)&lt;/i&gt;&lt;/b&gt; function creates a partial mock object, mixing mock and real functionality in the same object, this is an example how I used it.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;pre class=&quot;prettyprint&quot; style=&quot;overflow: auto;&quot;&gt;import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

import java.io.IOException;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.nebulaobjects.services.ForwardServlet;
import com.nebulaobjects.services.TestBase;

public class TestForwardServlet extends TestBase {

 protected ForwardServlet real, spy;
 protected ServletContext ctx;
 protected RequestDispatcher dispatcher;
 protected HttpServletRequest request;
 protected HttpServletResponse response;
 protected ServletConfig conf;

 public void setUp() {
  real = new ForwardServlet();

  spy = spy(real);
  conf = mock(ServletConfig.class);
  ctx = mock(ServletContext.class);
  request = mock(HttpServletRequest.class);
  response = mock(HttpServletResponse.class);
  dispatcher = mock(RequestDispatcher.class);

  when(ctx.getRequestDispatcher(anyString())).thenReturn(dispatcher);
  doReturn(ctx).when(spy).getServletContext();

 }

 public void testForward() throws ServletException, IOException {
  String version = &quot;v1&quot;;

  doReturn(version).when(spy).getInitParameter(&quot;version&quot;);
  spy.init(conf);

  when(request.getRequestURI()).thenReturn(
    &quot;/services/health/1/3/4/5/6/7/8/9/10/service&quot;);

  spy.forward(request, response);
  verify(ctx, times(1)).getRequestDispatcher(
    &quot;/services/&quot; + version
      + &quot;/health/1/3/4/5/6/7/8/9/10/service&quot;);
 }
}

&lt;/pre&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7703764077976468648/posts/default/3150121456572594128'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7703764077976468648/posts/default/3150121456572594128'/><link rel='alternate' type='text/html' href='http://octaviomartin.blogspot.com/2013/04/mocking-partially-class-mixing-mock-and.html' title='Partially mocking a class, mixing mock and real implementation'/><author><name>martoc</name><uri>http://www.blogger.com/profile/07450494412582567682</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-7703764077976468648.post-1755221234791856700</id><published>2013-03-20T13:00:00.003+00:00</published><updated>2013-05-12T20:59:17.263+01:00</updated><title type='text'>A system with a bad design is falling apart</title><content type='html'>Production log files are throwing this exception
&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;ERROR [org.hibernate.util.JDBCExceptionReporter] &#39;2.147504819E9&#39; in column &#39;1&#39; is outside valid range for the datatype INTEGER&lt;/pre&gt;
&lt;br /&gt;
I got that exception when some code was trying to get an &quot;int(11) unsigned&quot; and put it into a Java&#39;s Integer&lt;br /&gt;
&lt;br /&gt;
At the first look this exception seems a database problem but it is not, it is thrown by the MySql JDBC Driver&lt;br /&gt;
&lt;br /&gt;

&lt;pre class=&quot;prettyprint&quot; style=&quot;overflow: auto;&quot;&gt;
if (this.jdbcCompliantTruncationForReads) {
    if (valueAsDouble &amp;lt; Integer.MIN_VALUE
     || valueAsDouble &amp;gt; Integer.MAX_VALUE) {
         throwRangeException(String.valueOf(valueAsDouble), 
             columnIndex, Types.INTEGER)
    }
}
&lt;/pre&gt;

At the end, all calls to getInt have to be changed to getLong.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7703764077976468648/posts/default/1755221234791856700'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7703764077976468648/posts/default/1755221234791856700'/><link rel='alternate' type='text/html' href='http://octaviomartin.blogspot.com/2013/03/a-system-with-bad-design-is-falling.html' title='A system with a bad design is falling apart'/><author><name>martoc</name><uri>http://www.blogger.com/profile/07450494412582567682</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><georss:featurename>London, UK</georss:featurename><georss:point>51.511213899999987 -0.11982439999997041</georss:point><georss:box>51.195107899999989 -0.7652713999999704 51.827319899999985 0.52562260000002958</georss:box></entry><entry><id>tag:blogger.com,1999:blog-7703764077976468648.post-8613775812649907357</id><published>2013-03-18T13:07:00.004+00:00</published><updated>2013-05-12T20:54:40.935+01:00</updated><title type='text'>Creating a SSH tunnel to reach a mysql server</title><content type='html'>The first parameter is the local port followed by the remote endpoint &quot;host:port&quot; and finally the intermediate host, in this example I am connecting to&amp;nbsp;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;remotehostname:3306&lt;/span&gt;&amp;nbsp;(mysql server) which is only reachable&amp;nbsp;from the intermediate server (&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;intermediate-hostname)&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;$ ssh -L 3306:remotehostname:3306 intermediate-hostname&lt;/pre&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7703764077976468648/posts/default/8613775812649907357'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7703764077976468648/posts/default/8613775812649907357'/><link rel='alternate' type='text/html' href='http://octaviomartin.blogspot.com/2013/03/create-ssh-tunnel-to-reach-mysql.html' title='Creating a SSH tunnel to reach a mysql server'/><author><name>martoc</name><uri>http://www.blogger.com/profile/07450494412582567682</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-7703764077976468648.post-6590910666040329115</id><published>2013-03-09T23:55:00.003+00:00</published><updated>2013-05-12T20:55:43.103+01:00</updated><title type='text'>Creating an AppEngine Project using Maven</title><content type='html'>Execute this maven command&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;$ mvn archetype:generate -DarchetypeGroupId=com.google.appengine.archetypes -DarchetypeArtifactId=guestbook-archetype -DarchetypeVersion=1.7.5&lt;/pre&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7703764077976468648/posts/default/6590910666040329115'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7703764077976468648/posts/default/6590910666040329115'/><link rel='alternate' type='text/html' href='http://octaviomartin.blogspot.com/2013/03/creating-appengine-project-using-maven.html' title='Creating an AppEngine Project using Maven'/><author><name>martoc</name><uri>http://www.blogger.com/profile/07450494412582567682</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-7703764077976468648.post-5151136044383643046</id><published>2013-03-07T15:26:00.000+00:00</published><updated>2013-03-08T08:19:02.006+00:00</updated><title type='text'>Getting log files from different servers using SSH</title><content type='html'>&lt;br /&gt;
I&#39;ve got a list of servers 1-10, Using this command I am able to search into these log files&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;$ for h in 1 2 3 4 5 6 7 8 9 10; do ssh user@$h.hostname &amp;nbsp;&#39;echo &quot;server&#39;$h&#39;&quot;;cat /var/log/file.log | grep 2342343423&#39;;done&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7703764077976468648/posts/default/5151136044383643046'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7703764077976468648/posts/default/5151136044383643046'/><link rel='alternate' type='text/html' href='http://octaviomartin.blogspot.com/2013/03/getting-log-files-from-many-servers.html' title='Getting log files from different servers using SSH'/><author><name>martoc</name><uri>http://www.blogger.com/profile/07450494412582567682</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry></feed>