Installing Ubuntu on an old Macbook

I have an old macbook (year 2006) that had a crashed hard-disk over two years ago. At the time, the new disk with a clean install of OSX was very fast to start up, and it was not even a SSD.

The laptop was functional in my secondary office, at which I go maybe once at week. Normally, I’d use it to connect to a random linux server via the terminal.

However, it was clear that the laptop was unusable for web browsing due to the lack of software updates available.

I attempted to install but it only works for 64 bits. On the other hand, Ubuntu works, and here are a few of my notes:

  • Etcher is quite amazing for making a bootable USB drive: select the image file, then the destination USB drive, and click on the “flash” button.
    • This video was very useful: link
  • Etcher would not do the trick when trying to make a bootable USB for Unbuntu. Then I tried UNetbootin, which would not display the USB disk.
  • I had to “fix” the USB disk (erase volume, unmount, erase partition) via command line usage of diskutil
    • diskutil list: shows you the list of disks
    • diskutil eraseDisk: did not work, gave me an error on: Unable to begin erase operation: The target disk is too small for this operation (-69771)
    • diskutil eraseVolume FAT32 ABCD /dev/disk2: did the trick
    • diskutil unmount disk2: this is needed for the next step to work
    • sudo diskutil partitionDisk disk2 1 MBR FAT32 ABCDE R
    • Kudos to a stackExchange response (great, as usual) that was key to solve this
  • The USB drive then showed up on UNetbootin, for which I recommend downloading separately the .iso file (before using UNetbootin).

Recipe: Chinese pancake


  • 1 stick of green onions
  • 1/2 cup flour
  • 3/4 cup water
  • 1 egg

Chop the onion into 3mm pieces. Mixed all the ingredients. Set flame to high, and when the pan is hot, start with the first pancake, then change flame to medium from there on.

Cooking meals for an epsilon

My Statistics professor at graduate school said that stats scientists refer to their children as epsilon, because they are tiny.

Main dishes:

  • Turkey corn dog
  • Pasta (with/without beef)
  • Chicken nuggets
  • Steak fingers
  • Meatballs with gravy
  • Turkey and cheese roll ups
  • Fish sticks
  • Meatlof
  • Diced chicken
  • Spaghetti with meatballs
  • Soft beef tacos
  • Baked chicken strips
  • Salmon
  • Mac and cheese (avoid it)
  • Pizza (avoid it)


  • Baked fries
  • Tator tots
  • Bread
  • Rice
  • Pinto beans
  • Mashed potatoes
  • Corn


  • Mixed veggies
  • Salad
  • Green beans
  • Steamed broccoli
  • Fruit slices

Let’s talk while my daughter is at ballet, it is 1 whole hour!

tl;dr It is the spontaneous and unexpected that often make for nice memories.

“If your flight gets canceled, call me to pick you up” said my cousin after dropping me off at the airport. One hour later my flight was canceled due to snow in Atlanta. “We can arrange for a flight but you’ll get there at 9pm, unless you would like a first class seat on tomorrow’s flight.” said the airline employee. Yep, she said “first class”, I remember it very well, but this was at a city bordering Mexico, maybe she care more about getting the message communicated quickly. I took the “first class” option, and in a minute they printed my ticket (it was the first time I got a ticket with a row number consisting of 1 digit).

Instead of calling my cousin, I took the city bus back to downtown. Then I called a friend on the Mexico side of the border (using the US 800 number that his company has, and then just typing his 5-digit extension number). He picked me up on the Mexico side (after I walked across one of the bridges that connects US to Mexico). Then we went back to his (cubicle) office. “Can you wait 1 hour before going for lunch?” he said. The idea was that we would go for lunch with other three people, all of whom I’ve met before when I was also a cubicle-employee. We went to a good restaurant, affordable to them because they were single with no kids, and to me because I had US dollars paying for food in Mexico (I was on a graduate student budget).

Good friends, good food, good times. It was a great excuse to have a long lunch break for them because I was there. We talked about where other friends got jobs at,  who was finally dating, and so on and so forth. All thanks to the spontaneous and unexpected flight cancellation due to snow in Atlanta airport. Would any of this be possible 10 years later? unlikely. People have kids, busy kids. (Caterina Fake’s post is highly recommended). Among my friends that have kids, only the “least responsible”, or artsy, or with fewer “resources” are the ones that do not have their schedule affected by kids activities. These friends are the best for scheduling play-dates though.

I’ve heard stories of people missing their flight, which then brought nice experiences of exploring whatever city they were stuck at for a day. If given the choice of which connecting city to be stuck at for a day, I’ll likely choose the city where I have more friends that have no children, just to increase the chance that such friends are available. Otherwise, I’m stuck with just a coffee break, or with this comment by a friend that said: “let’s talk while my daughter is at ballet, it is 1 whole hour!”. On the other hand, I do not flight often anymore.

Athens to Altanta train recurring dream

tl;dr  personal note, just skip reading it.

I’ve had several dreams (throughout the years) that have something to do with a train that goes from Athens to Atlanta. It would be fun if some day I could take such a train just to say “I’ve dreamed this before”.

There’s some planning about building such a commuter train though.

It is unlikely that we will see any extra-terrestial intelligent life

tl;dr  Given the size of the universe, and statistics, it is extremely unlikely that we will see any extra-terrestrial intelligent life.

It was very unlikely that a child would get to a Gorilla in a Zoo (the story has been covered in many places such as this). We all make mistakes once in a while. Rarely though, a combination of unfortunate events or mistakes happen. In this case it was:

  • A parent did not keep an eye on their child for a minute or two.
  • The child made it into the gorilla area.
  • The design of the zoo was not 100% perfect for blocking access to the gorilla by visitors.

Not too long ago, I made a very minor mistake that was due to my lack of judgement. No one was harmed at all, no one even noticed, it did not affect any one or anything. It was fixable (with either 20 minutes of time, or $30 payment). My error was statistically unlikely. It was from the combination of two events: lack of judgement. The second event is something that I do at most once every two weeks. The probability of two independents events is usually calculated by multiplying the probabilities of each event. For example, if one event has a probability of 10%, and the other event has a probability of 5%, then the probability of both events happening is 10% times 5%, which is equal to half of a percent.

Hence, the probability of the Gorilla and child event, should be really small. This can be somewhat seen by the many years in which such an event has not happened before. (Remember that many many people with kids go to the zoo all the time).

Now, is it likely that there is intelligent life in different planets than ours? yes, of course. However, when we consider how big the universe is, it is extremely unlikely that we will see any extra-terrestrial intelligent life. Just think about how long it took for a satellite to get anywhere near Pluto to take photos of it at a good enough resolution so that scientist can figure out things about it. Or, think about the distances required and the speeds needed to get there alive. For example, even though I can see the moon, it takes an gigantic amount of energy and effort to get a human there. It has been decades since I last heard of fast-speed trains that could do a 300 miles trip in 40 minutes. Considering that we do not have a network of such trains to help us move faster between cities, what is the likelihood that we will organize things to go to other planets? If such delay happens here, it is likely to happen in other planets having intelligent life. Hence, they will not be showing up any time soon either. (They are probably on the sofa watching their version of popular TV shows or something like that).

Thus, no extra-terrestrial intelligent life showing up on our skies any time soon.

Mock testing in Zend with Doctrine: mimicking the mocking

A few notes about mock testing in Zend with Doctrine.

There is great material already about this topic (such as this, this, and this).

  • The goal is mocking the retrieval of the entity manager to avoid making a mess with the existing database.

“unable to create an instance for doctrine.entity_manager.orm_default”

The Bootstrap.php may be a place to fix the error “unable to create an instance for doctrine.entity_manager.orm_default” via adding the following line. It seems to “force” the service manager to initialize the instance.


However, a nice solution was to create the service via a constructor that receives both the service manger, and the entity manager. The service is not created in the controller. Instead, it should be placed in the Module.php file for the module. The service will then almost-never need to be created via ‘new’. This is how it looks like in Module.php:

public function getServiceConfig()
   return array(
      'factories' => array(
         'BagelService' =>  function($sm)
            $em = $sm->get('doctrine.entitymanager.orm_default');
            return new BagelService($sm, $em);

This facilitates mocking the entity manager. However, I did not follow that route.

Minor note: in our setup there is something not 100% perfect, which requires me to utilize ‘doctrine.entitymanager.orm_default’, which does not have an underscore between the words entity and manager.

My setup was to initialize the service passing only the service manager to its constructor. It is normally initialized inside of a controller. There is nothing about the service in the Module.php file.

Example of test setup and actual test.

Initialization in the setUp function is done through the Bootstrap class.

protected function setUp()
   $this->serviceManager = Bootstrap::getServiceManager();
   $this->bagelService = new BagelService($this->serviceManager);

Example test:

public function testBagelPromotion()
   $response = $this->bagelService->getPromotion();
   $this->assertEquals('Buy 1 bagel, get free coffee', $response);

In some tests, I’ve grouped several asserts together using an array as follows:

public function testObjectInitiallyEmptyValues()
    $fields = ['Items', 'Payments', 'Attachments'];
    $obj = new EntityABCDEF();
    foreach($fields as $each) {
        $this->assertCount(0, $obj->{'get' . $each }(),
           "'$each' should initially have zero elements.");

Example test mocking the entity manager:

public function testGetBagelById()
   // Create a dummy object
   $object = new BagelEntity();

   // Mock the entity manager
   $emMock = $this->getMock('EntityManager',
      ['getRepository', 'getClassMetadata', 'persist', 'flush', 'find'], [], '', false);

   // Create a mocked service, only mocking one method
   $mockedService = $this->getMockBuilder(BagelService::class)

   // setup the expectation of the method we are mocking

   // 'find' should return our dummy object
   $emMock->expects( $this->any() )

   // Call the mocked service requesting an object
   $response = $mockedService->getBagelById( 12 );

   // Check the response is the correct type of entity
   $this->assertInstanceOf(BagelEntity::class, $response);

   // Check that the returned entity is our dummy object
   $this->assertEquals('BAM12345', $response->getBagelNote());

There were tests where I did not utilize the mock entity manager because the functionality being tested did not require it. Examples: testing that requesting an entity by ID with an invalid ID returns null, and testing that QueryBuilder was generating a query correctly.

Why was all of this helpful?

  • I found out that we have functions that are repeated in other classes. My suggestion to the team lead (when she comes back from vacation) will be to have such functions moved to a Utility class.
  • I had to move some strings constants as actual defined constants in order to test the output of a few methods to avoid having the test-case break in case that our customer wants us to change something such as a description of an error message.