Thursday, September 24, 2009

Metaphors, valuable assets in conversations.

The company is in negotiations on selling one of my source code to one of our competitors. I was asked by the CEO to talk to the CFO regarding the risks and to come up with a price. The conversation was going nowhere. The CFO was totally lost regarding the source code. It was obvious that he did not understand the context of the conversation. Finally, I told him to think as the source code as a recipe. "Think of us as Coca-Cola (the company) and we have the recipe, the "secret formula", and now some other competitor like Pepsi wants to purchase it."

After that, we were both engaged on the conversations. The CFO was asking questions such as:
  • if we give them the recipe, they (competitors) can make as many cokes as they please.
  • how long did it take your team to create the recipe (in terms of hours, and most of all money).
All these questions contributed to a really good conversation. Afterwards, the CFO and I talked to the CEO and discussed our assessment.

In the book, Pragmatic Thinking and Learning, Andy Hunt explains methaphors and software as the following:
The idea is that any software system should be able to be guided by an appropriate metaphor

I couldn't agree more with him.

Tuesday, September 22, 2009

Hudson CI

I love the whole concept of Continuous Integration (CI). My first interaction with CI was using Cruise Control along with a team of Thought Works (great guys!). However, I noticed that the configuration is all XML and it could be cumbersome. In my previous project, only a few individuals really know how to configure it.

I have been slacking on using CI (not proud of it) for two reasons:
1. I only have two programmers and they are here in Miami. Most of the time they pair programed together.
2. I didn't want to bring the pain of XML into the company.

However, I just acquired a new programmer and he is located in Mexico. I have also noticed broken builds due to items not being checked, some broken unit tests, etc. Perfect candidates for CI. Last week, I decided that instead of calling the programmers and asked them to solve the problem, I would install a CI server but not Cruise Control. I have heard a lot of great things from Hudson. Today I just finished the installation. Really nice and easy. Now, I need to finished the configuration with the deployment, SVN, and other few items. But, I'm really exited to be back into the CI world. My team should be more effective and hopefully we can increase the amount of deployments. It was wrong for me of not using CI from the beginning. Even if we would have implemented Cruise Control we would be better than today.

Monday, September 21, 2009

mysqldump from external db to local db

Sometimes I need to transfer data from my remote database (product/test) to my local box. I usually use dbUnit to avoid the transfer. However, sometimes I need to use specific data to solve either a specific bug. If you are using MySQL, then most likely you are using mysqldump. It's a really good tool. Here is how I transfer data from my test environment (marcelo.prod) to my local box without affecting (delte, truncate, or doing anything to my current schema):

mysqldump -h marcelo.prod -uprod_username -pprod_password --skip-create-options --no-create-info --no-create-db --compact --skip-add-drop-database --insert-ignore --where="OPERATOR_SERVICE = 'MBLOX_US'"  upmobile OPERATOR_TBL | mysql -uroot -psecret upmobile

I also use this code to transfer data from my production database to my historic database.

Sunday, August 2, 2009

Twitter Business Model?

I have been reading a couple of articles about Twitter, simple because I believe that it is a disruptive technology to the SMS.

Two articles that really got my attention:
Both articles where really impressive and very insightful, but by the end of the day I came up with one question, how in the world are they paying for all those BILLION messages? How come companies such as Facebook or Twitter who have over 400 - 500 million users aren't profitable? Everyone is saying that they are waiting for an IPO, but I'm not sure if that's going to happen any time soon. I mean, I doubt that anyone will be OK by getting an ad on their phone.

Time's provided a great example on how Twitter is changing the way we established conversations:
Injecting Twitter into that conversation fundamentally changed the rules of engagement. It added a second layer of discussion and brought a wider audience into what would have been a private exchange. And it gave the event an afterlife on the Web. Yes, it was built entirely out of 140-character messages, but the sum total of those tweets added up to something truly substantive, like a suspension bridge made of pebbles.

Understood, but wait...someone is paying for all these standard rate messages. You see, I'm in the business of monetizing from these type of messages. I provide what people called Premium Short Messages (PSMS). Indeed, the market that controls all that downloadable content such as ringtones, wallpaper, subscriptions, etc has paid my bill. I don't hate Twitter, is a matter of fact I think is the future, just like I think the "Free" business model that Chris Anderson talked in his book is the 21st century model. However, it seems crazy to me to have such a financial hemorrhaging (the cost of short-codes, and standard rate messages is quiet high).

The Economist's article caught my attention on the amount of money that the founders have gained,
... a hacker recently leaked documents after gaining access to the private e-mail accounts of a Twitter employee and the wife of one of its founders, the blogosphere was abuzz. The haul included a spreadsheet showing revenues reaching $140m by the end of 2010, up from $4.4m this year.
Later it mentioned about the most-likely case scenario for Twitter:
Embedding advertisements in “tweets”, short text messages that can be up to 140 characters long, is unlikely to appeal to users. A better bet would be for the firm to charge corporate users for premium services. For example, it could pocket a fee from businesses for verifying their Twitter accounts, so that users following their postings would know the firms’ tweets are genuine. It could also develop a statistical toolkit that measures the effectiveness of tweets in generating sales.

Sunday, July 19, 2009

Unix Admin Mantra - "Only the paranoid survives"

I am not a Unix admin. I had to pick it up due to the fact that I'm working on a small start-up company. I quickly learned that the mantra of Andrew Grove from Intell, "Only the paranoid survives" best fit for this type of job. System admins need to be ahead of the curve. The other day, I went to restart the only windowns server that I have and noticed an error in one of my Unix servers. The message was that I had a bad memory chip. How can I check if everything is OK, specially since my server are in a data center? Then I found out from Linux Journal that I can use SNMP and Nagios to get this type of monitoring. I will be playing with it along as with Ruby for the next couple of weeks. I hope to get status of memory modules, fans, and power supplies in each of my servers.
SNMP (Simple Network Management Protocol) is a network protocol designed for monitoring network-attached devices. It uses OIDs (Object IDentifiers) for defining the information,
known as MIBs (Management Information Base), that can be monitored. The design is extensible, so vendors can define their own items to be monitored

Teams - different breeds

I am a big believer of teams. When I completed my MBA, it was a huge shock for me. Most of my work was in teams. Being a Computer Science graduate, I always wanted to do the work either alone or with other individuals that were developers or knowledgeable in the computer field. During my MBA at the University of Miami, I learned much about teams. One thing that stuck with me is that cohesive teams become more united during great circumstances. Think about Hurricane Andrew, Hurricane Katrina, or 9-11. During these times, people came together for one particular cause, their communities. The same thing happens when the team itself feels threaten.

I recently moved, and noticed that the drier of my new home was not working. Yesterday I called my landlord to explain to him about the problem. His voice started to break, and told me that his 17 year-old son drowned the day before and that he was going to take care of the drier issue later. Words cannot explain how I felt. I have a seven-year-old and he and my wife are my life. I cannot imagine what I would do if something similar happened to me. I told my landlord that he shouldn't worry about it, and that I would fix it and for him to focus on his family.

A day later, three gentleman came to the house and fixed the problem with my drier. They said that they came in behalf of my landlord. I found out that my landlord is the chief of the Miami Fire Department and they are proud to help their chief. One of the gentlemen told me,
Fire Departments are a different animal. We take care of our people.
I was deeply moved. It also made me think, would my team do the same thing for me? Would my friends? My wife and I picked up a sympathy card to send it to our landlord. I can't imagine what is he going through, but I would take this opportunity to remind me how vulnerable we are. Indeed, the hardest times reveal the true friendships.

Thursday, June 18, 2009

Tomcat Event Handler - privileges

In the previous post regarding Tomcat and Event handler, there was one major problems, privileges. NRPE is a daemon that run in the background when it's launched by nagios. The event handler developed launched "kill" when tomcat did not stop gracefully. Also, when trying to execute the application, the following error happened:
sudo: sorry, you must have a tty to run sudo
The solution is having a service application running the main application. In this example, restart-tomcat-eventhandler.sh is the service which calls restart-tomcat.sh. Also, I made the applicaiton (restart-tomcat.sh) to run in the background mode. But first, below are the changes that we need for the sudoers (visudo), alter the default for requiretty and the privileges for the nagios user to:
Defaults:nagios    !requiretty
...
nagios ALL=(ALL) NOPASSWD:/opt/tomcat/bin/catalina.sh,/bin/kill,/opt/tomcat/bin/startup.sh
The service application also takes care for the logging mechanism, and verifies that only one process is running for the restart-tomcat.sh
#!/bin/sh
#
# Application that launches the restarting of tomcat.
# The application will be launch in the background but
# its logging will be set in the LOGGER
#
LOGGER=/usr/local/nagios/libexec/eventhandlers/restart-tomcat.log
EVENT_HANDLER_APP=/usr/local/nagios/libexec/eventhandlers/restart-tomcat.sh
echo "Restarting Tomcat `date`...."
count=` ps -ef | grep -c '[r]estart-tomcat.sh' `
echo "Total process running: $count"
typeset -i count
if [ $count -ge 1 ]
then
echo "Another process is running and so the script will stop `date`"
exit
fi
$EVENT_HANDLER_APP >> $LOGGER 2>&1 &

The actual event handler is the following:

#!/bin/bash

#
# tomcat-restart.sh - tomcat restart script for cron
# Need to have access to the sudo to restart the tomcat
# Also, modify the visudo

echo "---------------------`date`---------------------"
CATALINA_PATH=/opt/apache-tomcat-6.0.18
CATALINA_SCRIPT=catalina.sh

echo "CATALINA_HOME : $CATALINA_PATH"

# Verify that tomcat is not running. If it is, stop it gracefully
# get the tomcat pid
tomcat_pid=`ps -ef | grep java | grep tomcat | cut -c10-14`
echo "Tomcat PID is: $tomcat_pid"

if [ -n "$tomcat_pid" ]
then
echo "Stopping tomcat ..."
sudo $CATALINA_PATH/bin/$CATALINA_SCRIPT stop
# give tomcat 60 seconds to shutdown gracefully
sleep 60
fi

tomcat_pid=`ps -ef | grep java | grep tomcat | cut -c10-14`
# if tomcat_pid exists, kill the process
if [ -n "$tomcat_pid" ]
then
echo "Noticed that process is still running trying to kill it"
sudo kill $tomcat_pid
sleep 60
fi

tomcat_pid=`ps -ef | grep java | grep tomcat | cut -c10-14`
# if tomcat_pid still exists, really kill the process
if [ -n "$tomcat_pid" ]
then
echo "Forcefully killing the process for tomcat $tomcat_pid..."
sudo kill -n 9 $tomcat_pid
sleep 60
fi

# restart tomcat
echo "`date` Starting tomcat..."
sudo $CATALINA_PATH/bin/$CATALINA_SCRIPT start
echo "`date` Finished starting tomcat"
echo "---------------------------------------------"