Frank Underwood’s letter to President Walker

This is a transcript of Frank Underwood’s letter to President Walker in episode 26 of season 2 of House of Cards.

Dear Mr President,

I’m writing you on an Underwood portable my father gave me when I left for the Sentinel.

It was the words my father said when he gave it to me that resonated even more than this 70-year-old machine.

“This Underwood built an empire,” he said. “Now you go and build one of your own.”

Those words have been a large part of what motivated my life.

I’ve only written one other letter with these keys. It did not fail me then. I hope it will not fail me now.

You said I wanted to diminish you. The truth is I don’t.
You said I wanted to challenge you in 2016. The truth is I don’t.
You said I wanted the presidency for myself. The truth is… I do.

What politician hasn’t dreamed about what it would be like to take the oath of the highest office of our land?

I’ve stared at your desk in the Oval office and coveted it. The power. The prestige. Those things have a string pull on someone like me – who came from a small South Carolina town with nothing.

But since you assumed office, my only aim has been to fight, for you and alongside you. Whether that be in Congress or, as now, the battle over impeachment.

Maybe one day I’ll have my chance to serve as president, but not while you are the nation’s leader.

And in you, sir, I see a brave man. A just man. A president whom I would follow anywhere no matter how strong the wind blows against us.

I want to tell you something I have never told anyone.

When I was 13 I walked in on my father in the barn. There was a shotgun on his mouth. He waved me over. “Come here, Francis,” he said. “Pull the trigger for me.”
Because he didn’t have the courage to do it himself.
I said “No, Pop,” and walked out, knowing he would never find that courage.

The next seven years were hell for my father, but even more hell for my mother and me. He made all of us miserable, drinking, despair, violence.

My only regret in life, is that I didn’t pull that trigger. He would’ve been better off in the grave and we would have been better off without him.

I’m not going to put you in the same position as my father put me in.

You will find enclosed, on a separate sheet, a confession to the crimes you have been accused of. They’re false words, but my signature will make them true.

Use them if you must.

If you truly believe that I have only served myself, then I have forever lost your trust. All I can do now is give you my freedom to save your own. I said I would take the fall for you, and now I give you the means to make that happen.

I am pulling the trigger myself. We all must make sacrifices to achieve our dreams, but sometimes we must sacrifice ourselves for the greater good. It is my honor to make such a sacrifice now.

Your loyal friend, still in my heart, if not in yours,

Francis.

Posted in Uncategorized | Leave a comment

Tips for running cassandra shuffle

If you want to upgrade from a pre 1.2.X Cassandra version to the new vnodes available in Cassandra 1.2.X+ you will want to run cassandra-shuffle as part of the migration procedure.
This can be… cumbersome.

You should really prepare yourself. Really. Don’t do it without reading. A LOT.

First read and understand this: http://www.datastax.com/dev/blog/upgrading-an-existing-cluster-to-vnodes-2

The procedure will take up a lot of everything. Time, network bandwidth, disk space, you name it.

This picture represents roughly 5 hours of running shuffle on a 450GB hdd (and the shuffle process is supposed to run for weeks)

size growth

I had a cluster with nodes that had 300GB storage, 40% use. My installation ended up crashing when it reached 100% use, I added an additional volume of 450GB to each of them, they filled too. I have no idea how much storage you really need because I ended up running shuffle for a time, stopping it, running cleanup and compact, restarting it, rinse and repeat.

Here’s some stuff I learned from the experience.

If you can avoid it, please do. If you have the hardware capabilities for duplicating your cluster in the new version, iterating and inserting all the data, please do that. It’s the best option for maximising balance and minimising headaches.

If you can’t, be sure to
- Minimize writing operations: If you can put your cluster in “read-only mode”, do that for as long as shuffle is running. Intensive writing operations really interfere with the process making it all but impossible.
- Decrease your RF: You are going to need a lot of disk space. You can temporarily decrease the RF and up it when you finish (don’t forget to repair after!) to minimise data transfer also.
- Run cleanup: I did not try to run it at the same time as shuffle was active, but keep in mind that when changing token ownership Cassandra streams the data to the new node, but it does not delete it from the previous owner. Cleanup helps to reclaim that space.
- Monitor everything closely: I had to course correct a few times, and stop everything when my disks were filling. This depends on your configuration though. But don’t just run the shuffle and go to sleep, everything can break.

Remember that disabling the shuffle only disables the scheduler, everything that’s running will keep running (streams for example)

Good luck! And remember: Try not to shuffle!

Posted in programming, tips | Leave a comment

How to refresh your varnish configuration without restarting

Many apps require you to restart them to read changes to their configurations. Luckily varnish is not one of them!

If you change your vcl file, there is an easy way to reload it without losing all your cached objects in memory.

Simply connect via varnishadm, load the configuration, and tell varnish to use it!

By default, administration is listening in port 6082, so connect like this

varnishadm -T localhost:6082

You should then enter the console

200
-----------------------------
Varnish Cache CLI 1.0
-----------------------------
Linux,3.2.0-23-virtual,x86_64,-smalloc,-smalloc,-hcritbit
varnish-3.0.4 revision 9f83e8f

Type 'help' for command list.
Type 'quit' to close CLI session.

varnish>

Now we need to load the configuration form disk

varnish> vcl.load default /etc/varnish/default.vcl

“default” is just the name and can be anything you want.

Then, we just tell varnish to start using it.

varnish> vcl.use default

That’s it! Your varnish instance is now using the new configuration.

Happy caching!

Posted in programming, tips | Tagged , , | Leave a comment

Es simple, es?

Sé que muchos deben estar en la punta del asiento esperando a ver como se da todo luego de mi último post. Pues estoy aquí para decirles.

Hoy me levanté y no tenía servicio en mi teléfono, tenía entendido que antes debía llegar un SMS que avisara el día exacto en el que se produciría el cambio, pero nunca llegó. No se si la responsabilidad de dicho SMS es de la empresa que dejas (en mi caso Personal) o de la entidad intermedia que se encarga del cambio, tal vez lo averigüe luego para saber a quien culpar.

Como me queda de camino al trabajo, pasé por las oficinas de Claro para que se fijen si el trámite estaba terminado (y para cambiar mi SIM por un micro SIM, ya que no te lo dan directamente cuando inicias el trámite) y me puse contento de ver que ya estaba la línea Claro activa.

Simplemente cambié el chip, y voilà! Super velocidades de datos, justo lo que el médico me recetó!

Claro data

Espero que sea el inicio de una larga relación de intercambio de dinero por felicidad en forma de transmisión de datos.

 

Posted in life, technology | Tagged , , | Leave a comment

Portabilidad numérica en Argentina

Finalmente me decidí a dejar Personal para pasar a Claro.
Por qué? Porque Personal tiene un servicio MUY malo en Capital Federal (al menos de datos, que es lo que me interesa en particular)

- “Pero, seguro es una sensación tuya!”

Eso sospeché, pero por suerte tengo amigos que tienen Claro que me pudieron prestar su SIM para usar en mi teléfono.

El resultado? Una imagen dice mucho

Claro - speed test

- “Pero, cuanto te daba con Personal?”

Personal - Finding closest server

No salió de ahí.

En fin, terminé el trámite el viernes (que fue muy sencillo, se hace directamente en la compañía destino, con el DNI, la última factura de la compañía anterior, y el comprobante de pago de dicha factura — del resto se encargan ellos) y hoy (lunes) recibí el adiós de personal

Personal - Adios

Personal te agradece haber sido parte de esta experiencia. Podes regresar en 60 días. Seras Bienvenido.

No creo que lo haga, pero gracias!

Bah… si Claro se convierte en la mala, y Personal mejora, tal vez lo haga… es la gracia de esta ley.

Posted in life, personal | Tagged , , , | Leave a comment

Packaging and executing a java program from within java

For a proof of concept for a project I’m working on (I will probably blog about it in a few weeks) I needed to make a java program execute another one that has a lot of library dependencies.

I experimented with a lot of ways to package it and make it self-contained, like the Maven Assembly Plugin, but it behaved weirdly… I wasn’t even able to track exactly what it did.

I eventually settled with creating a package file that contains the main application jar file, and all its dependencies in a /lib directory with the Maven Dependency Plugin – simple and awesome.

All you need to do is add the following configuration to your pom.xml file:

<build>
	<plugins>
		<plugin>
			<groupId>org.apache.maven.plugins</groupId>
			<artifactId>maven-dependency-plugin</artifactId>
			<version>2.4</version>
			<executions>
				<execution>
					<id>copy-dependencies</id>
					<phase>package</phase>
					<goals>
						<goal>copy-dependencies</goal>
					</goals>
					<configuration>
						<outputDirectory>${project.build.directory}/lib</outputDirectory>
					</configuration>
				</execution>
			</executions>
		</plugin>
	</plugins>
</build>

And run mvn package. This will generate the files in your /target directory

Running that application, is easy using the ProcessBuilder class and a little script to build the command line… command.

I created two sample projects that you can download from GitHub to see this working, but the gist of it is this (this is the run.sh file you can find in the samples):

cd $1
jars=""
for i in *.jar lib/*.jar;
do
    jars=$jars$i":";
done
java -Dfile.encoding=UTF-8 -cp $jars. com.seniorgeek.samples.scfj.program.App

To see it working you need to:

  1. Download the samples
  2. Run mvn package on Program
  3. Copy the main jar and the /lib directory in /target to /workspace/test1 in Executor
  4. Run Executor

That’s it, if everything works, you can see in your console a greeting to the universe (greeting just the world is getting old).

Program has some dummy dependencies in its pom file just to illustrate the example, you can ignore them.

Let me know if you have any problems or questions.

Posted in programming, samples | Tagged , | Leave a comment

Spring MVC with Jetty

I always like to try new things. There’s nothing I like more than using a technology I don’t know, and learn it by trying it out.

I heard a few coworkers talking about jetty, and I decided I wanted to try it in a project I’m working on.

Jetty provides an HTTP server, just like Tomcat, but you can create it from within your application, instead of having your application run “inside it”. This allows you to run your application as a Java app and provide an HTTP endpoint, without any need to administer something external to it like a Tomcat.

I created a sample application that uses Jetty with Spring MVC (with a custom view resolver that transforms any object returned to json). You can download it from github.

As you will see in the sample, it couldn’t be easier to use, the most relevant part is when you create the jetty server:

Server server = new Server(8082);
Context root = new Context(server, "/", Context.SESSIONS);
DispatcherServlet dispatcherServlet = new DispatcherServlet();
dispatcherServlet.setContextConfigLocation("classpath:application-context.xml");
root.addServlet(new ServletHolder(dispatcherServlet), "/*");
server.start();

That will create an HTTP server on port 8082 and initialize Spring MVC (be sure to have all dependencies in your pom.xml file, see the sample).

The next thing I wanted was to have any object returned transformed into json. For that, I created a custom view resolver that just gets the view and adds the object to it, like so:

 

public class SampleModelAndViewResolver implements ModelAndViewResolver {
    public ModelAndView resolveModelAndView(Method handlerMethod,
        Class handlerType, Object returnValue,
        ExtendedModelMap implicitModel, NativeWebRequest webRequest) {

        ModelAndView v = new ModelAndView("jsonView");
        v.addObject("data", returnValue);
        return v;
    }
}

If you download the sample and run it with eclipse (as a Java app), you will see than in less than 2 seconds you can navigate to http://localhost:8082/data and get an object formatted as json

Screen Shot 2012-05-08 at 11.03.15 AM

I hope this helps anyone that wants to try this stuff, let me know in the comments if you have any problems with it!

Posted in programming, samples | Tagged , , , | Leave a comment

How to take screenshots in MacOS

The thing I missed most from Windows when I left it behind, was the Snipping Tool.

That baby was awesome to quickly take a screenshots and paste them in gmail, or whatever tool you needed.

When I was in Linux, I found shutter but, as everything in Linux, it was not pretty and not so easy to use.

After I arrived in MacOS, that is the first thing I looked for and, luckily, it was integrated into the operating system.

These is how you do it:

  • Save screenshot of entire screen as file in the desktop: Shift + Cmd + 3
  • Copy screenshot of entire screen to clipboard: Shift + Cmd + 3 + Ctrl
  • Save screenshot of window as file in the desktop: Shift + Cmd + 4 and then Space
  • Copy screenshot of window to clipboard: Shift + Cmd + 4 + Ctrl and then Space
  • Save screenshot of arbitrary area as file in the desktop*: Shift + Cmd + 4
  • Copy screenshot of arbitrary area to clipboard*: Shift + Cmd + 4 + Ctrl

*: This is the snipping tool behavior that is not present in Linux

As you probably also noted, the difference between saving as a file and copying to the clipboard in each case, is Ctrl

Posted in mac, tips | Tagged | Leave a comment

My journey through technologies

I’ve always loved Microsoft products.

My first (real) computer came with Windows 95 (That’s not counting my commodore 128… although I should, because that’s what started my love for technology when I was just a little boy).
Right about that time, I started using them in high school and they all came with windows (3.1 some of them), and I had no idea there was something else — computers were not that cheap in those times, and not everyone had access to them here, so there wasn’t much variety out there, and no internet yet.

After I graduated high school, I got my first job as a programmer — VB6 and ASP classic were the first things that earned me my first bucks.

My professional career then led me to learn .NET, and that’s what I’ve been programming ever since — from the early betas to 4.0.

That was my focus until my current job, where they decided to replace all Microsoft technologies for alternatives, and all programming shifted to Java.

I seized the opportunity to learn new stuff and joined the Research & Development team, where the job description was exactly that: Research new stuff, try it, see what works, be creative.

The most awesome thing that came out of it, was migrating from SVN to GIT.
That, again, forced my hand. GIT support for Windows is not… good. Sure, you have a few tools, like Tortoise Git and msysgit – which are good, but not that good.

It was time to take another step and try Linux. I installed Ubuntu with dual boot (just in case I needed my Windows for something), eclipse, and Git. After a few (a lot) of headaches, I got everything working, and it was awesome. I discovered the power of the command line!

Nothing beats using Git from a console.

But I wasn’t that comfortable really. Eclipse looked awful, making it look good was difficult and I wasn’t even able to make Steam work (no support, and WINE is just not prepared for it).

I felt like Windows was in one end: user friendly, easy, and pretty, but when you want to do more, you hit walls. Linux was on the other end, you can do a lot of stuff, but everything is very manual (granted, there is A LOT of support, and everything was done by someone else in the past but hey, it’s work too) and complicated, from installing a printer to connecting to a VPN, a lot of stuff to be done.

And so I found myself wishing there was something in between. Something pretty like Windows and powerful like Linux.

“There is something I’m yet to try” I thought to myself. And that thing was MacOS. So I went out and bought myself a MacBook Air.

MacBook air

Oh boy… it’s awesome. Everything I need to work, just works, and all I need to do, I can do.

Sure, they are expensive, but so worth it. I would highly recommend getting one if you can.
I instantly loved it and, after one day, I had everything working as I wanted it, and once I learned the hotkeys and to use its awesome trackpad, my productivity increased a lot.

If only there was a Windows Live Writer alternative for MacOS, I’d be a really happy guy.

Well, that’s the present. We’ll see what’s in store for me in the future… all I hope for is that it’s awesome.

Posted in mac, opinion, technology | 1 Comment