Building and installing Apache Flood (or at least as far as I got)

A more complete installation of Apache Flood (http://httpd.apache.org/test/flood/building.html)


svn co http://svn.apache.org/repos/asf/httpd/flood/trunk flood
cd flood/
svn co http://svn.apache.org/repos/asf/apr/apr/trunk apr
apt-get update && apt-get install autoconf libtool libxml2-dev make libapr1-dev libaprutil1-dev
./buildconf
./configure --disable-shared --with-libxml2
make all

Stopped here, as I get errors when trying to compile.
I hope this helps someone.

Globe’s GoSurf Plans Analysis

Pesos Mb Mb per peso Peso per Mb Days Mb per Day
10 40 4.000 0.250 1 40
15 40 2.667 0.375 2 20
30 100 3.333 0.300 1 100
50 350 7.000 0.143 3 117
50* 700 14.000 0.071 3 233
50* 350 7.000 0.143 7 50
99 200 2.020 0.495 30 7
199 500 2.513 0.398 30 17
299 1500 5.017 0.199 30 50
499 3000 6.012 0.166 30 100
999 5000 5.005 0.200 30 167
1799 10000 5.559 0.180 30 333
2499 15000 6.002 0.167 30 500

* Prepaid only

Some observations:

  • Prepaid have the best deal in terms of cost per MB with the newest GoSURF 50 promo. Useful if you need to upload/download in a pinch.
  • GoSURF 499 is best value for money for 30 day plans.
  • Because there’s a No bill shock protection cap on Php 1,500, it’s almost never worth getting the 1799 and 2499 plans.

Note to self:

Remove devise_for in routes.rb if you’re trying to generate a scaffold of an already existing model.

Steps to replicate:

  1. rails g model Foo name
  2. rails g devise Foo
  3. rails g scaffold Foo –skip
    1. This would result with the error: The name ‘Foo’ is either already used in your application or reserved by Ruby on Rails. Please choose an alternative and run this generator again.

Commenting the devise_for line in routes.rb will allow you to proceed with the scaffold.

ER, Confinement and HMO Plans

My 1 year old nephew got sick recently and it was an instant Php 10,000 ER trip. As I build my emergency fund, I sometimes get scared that I’m just 1 hospital trip away from starting back from scratch (or worse.) *knocks on wood*

So, I asked Uniguarantee (one of our clients, an insurance brokerage firm, no website yet :(, here’s a reference ) on what my options were.

I had 3 levels that I can cover: ER, Confinement and Health Maintenance.

Continue reading ER, Confinement and HMO Plans

Fear of rejection

I remember the last time I’ve had panic attacks. We were new to the work, and I knew about it in theory, but did not have first-hand experience with it. This was the first time, but I gave my 100% and researched the heck out of it but the client rejected our work.

I was devastated. As a result, I kept putting off having them check our work again. The project dragged on, and as a result, is delayed by a long time.

Oddly enough, I know that it’s all in my head. That failure in one thing isn’t really a failure if I learn from it and turn it into a success.

I know that. In theory.

I’ve tried to acknowledge the fear. Many times. By calling it out.

Nobody is perfect. You can make mistakes. You’re just scared.

But I guess I still need lots of practice.

Minitest with Kaminari

While converting my tests from FactoryGirl.create to FactoryGirl.build_stubbed, I ran into trouble with Kaminari. Here’s how I fixed it.

Kaminari

Kaminari functions by adding .page() (and some other methods) at the end of your ActiveRecord call chain. A typical example of paginating via Kaminari is as follows:

class UsersController < ApplicationController
  def active_users
    @users = User.active_users.page(params[:page])
  end
end

This is a problem when you’re trying to stub out the return of the AR call to return an array. Here’s a corresponding test that would fail:

require 'test_helper'

describe UsersController, "#active_users" do
  test "success" do
    users = FactoryGirl.build_list :user, 3
    User.expects(:active).returns(users)
    get :search, term: "admin_user"
    assert_response :success
  end
end

Because users is just a regular array here, and Kaminari tries to call .page() on the array, it would fail with a NoMethodError: undefined method `page’ for # because Array#page isn’t defined.

Trying to stub out .page() by users.stubs(page: users) would give you ActionView::Template::Error: undefined method `model_name’ for #. And so on, as long as you’re using Kaminari-specific methods.

The solution

The solution is pretty simple (but took me 2+ hours to research). Call Kaminari.paginate_array on the FactoryGirl.build_list.

users = Kaminari.paginate_array FactoryGirl.build_list :user, 3

From the documentation:

Kaminari::paginate_array method converts your Array object into a paginatable Array that accepts page method.

For now, I’m putting the Kaminari.paginate_array inside the test, but long term, it makes sense to put it in the controller code. This way, even if we change User.active to return an array, no other code would break. Then again, that’s why we have tests, right?

Protein Bar Attempt #2

After almost 2 weeks, my protein bars attempt #1 are finally done so I mixed up a new batch with the following recipe:

  • 300g Quaker Oats Quick Cook Oatmeal
  • 3 scoops Optimum Nutrition Double Chocolate Flavor
  • 340g Ludy’s Sweet and Creamy Peanut Butter
  • 250ml Surebuy Coconut Cream

This batch turned out better than last time. The consistency is closer to what I want.  For now, this will be my go to recipe. I’ll probably play around with using a different brand of peanut butter and/or oatmeal.

Where there was smoke (Me and my friends’ fire survival story)

As some of you probably already know, there was a fire at Prince David Condo, a building in front of Ateneo Friday afternoon.

What most of you probably did not know, my friends and I was there. We were at the top most floor, right below the roof deck.

Photo lifted from https://anc.yahoo.com/news/fire-breaks-out-at-qc-condo-055800824.html
Photo lifted from https://anc.yahoo.com/news/fire-breaks-out-at-qc-condo-055800824.html

Thankfully, we all survived.

Here’s our story, from my POV.

Continue reading Where there was smoke (Me and my friends’ fire survival story)