Nerd - Developer - Entrepreneur

Flush DNS Cache in OS X Lion

Posted: March 9th, 2012     Reminders to myself

sudo killall -HUP mDNSResponder

Fixing slow local DNS queries in OS X Lion

Posted: March 6th, 2012     Nerdicious   Web Development

Since installing OS X Lion, I noticed that all my local websites (developing on MAMP) would take 5 seconds to load up. When tracing it back, I found that it was actually doing a long DNS lookup, failing, then falling back to the /etc/hosts file.

To fix this, you need to add the IPV6 value to every hosts entry in /etc/hosts

e.g.

127.0.0.1    www.ballistiq.local
fe80::1%lo0  www.ballistiq.local

Requests will be instantaneous after that.

Lebanese Style Stuffed Eggplant

Posted: February 25th, 2012     Food

This recipe took a little bit of work to pull off but came out surprisingly well. I found this to be very tasty. :)

~6 small eggplants
1/2 cup long-grain or jasmine rice
1/4 cup olive oil
3 tablespoons pine nuts
1 large onion, finely chopped
2 garlic cloves, finely chopped
2 cups chicken stock
1 (14 1/2-ounce) can diced tomatoes in juice
3/4 pound beef or lamb chunks
1 teaspoon ground allspice
lemon juice
3 tablespoons chopped flat-leaf parsley

Preheat oven to ~350 degrees.

Hollow out each eggplant with a melon-ball cutter, working from bottom end and leaving about 1/3 inch eggplant flesh along interior walls.

Rinse rice in a sieve under cold water until water runs clear. Drain well.

Heat oil in skillet. Fry pine nuts until golden. Put pine nuts in bowl. Fry onion and garlic until golden. Transfer to bowl with pine nuts. Put stock, tomatoes, 1/2 teaspoon salt, 1/4 teaspoon pepper in skillet and simmer while stuffing the eggplant.

In a giant bowl, mix rice, meat, allspice, 1/2 teaspoon salt, 1/2 teaspoon pepper, onion/pine nuts mixture. Mix mix mix.

Stuff eggplants with mixture.

Put eggplants in baking dish. Mix the stuffing that you took out of the eggplant into the sauteed tomatoes and transfer to the baking dish along with the eggplants. Bake for 25 minutes, turn over, bake for another 25 minutes. Sprinkle lemon sauce and parsley over the dish. Ready to serve. This is spectacular.

Sauteed Parsnips and Carrots with Honey and Rosemary

Posted: February 25th, 2012     Food

This is very tasty and unfortunately most of the health benefits of the vegetables are completely wiped out by the honey. :)

2 tablespoons extra-virgin olive oil
1 pound carrots (about 4 large), peeled, cut into 3×1/4×1/4-inch sticks
1 pound large parsnips, peeled, halved lengthwise, cored, cut into 3×1/4×1/4-inch sticks
Coarse kosher salt
2 tablespoons (1/4 stick) butter
1 tablespoon chopped fresh rosemary
1 1/2 tablespoons honey (such as heather, chestnut, or wildflower)

Heat oil in large skillet over medium-high heat. Add carrots and parsnips. Sprinkle with coarse kosher salt and pepper. Sauté until vegetables are beginning to brown at edges, about 12 minutes. DO AHEAD: Can be made 1 day ahead. Cover and chill.

Add butter, rosemary, and honey to vegetables. Toss over medium heat until heated through and vegetables are glazed, about 5 minutes. Season to taste with more salt and pepper, if desired.

Chicken Parmigiana Recipe

Posted: February 25th, 2012     Food

This has to be one of my favourite recipes of all time.

2 egg, beaten
1/4 pound dry bread crumbs
4 skinless, boneless chicken breast halves
1-1/2 (16 ounce) jars spaghetti sauce
1/4 pound shredded mozzarella cheese
1/2 cup grated Parmesan cheese

Preheat oven to 350 degrees F (175 degrees C). Lightly grease a medium baking sheet.

Pour egg into a small shallow bowl. Place bread crumbs in a separate shallow bowl. Dip chicken into egg, then into the bread crumbs. Place coated chicken on the prepared baking sheet and bake in the preheated oven for 40 minutes, or until no longer pink and juices run clear.

Pour 1/2 of the spaghetti sauce into a 7×11 inch baking dish. Place chicken over sauce, and cover with remaining sauce. Sprinkle mozzarella and Parmesan cheeses on top and return to the preheated oven for 20 minutes.

Bak Kut Teh – Chinese Pork Rib Soup

Posted: January 27th, 2012     Food   Reminders to myself

I’ve been experimenting with making bak kut teh – basically pork rib soup. It’s super yummy. I finally got it down tonight.

Ingredients (serves 2)

  • ~900 grams of pork ribs
  • 1 bulb of garlic (yes, a whole bulb) – take out all the cloves and peel them
  • 5 star anise
  • 3 cinnamon sticks
  • 1 tablespoon of white peppercorns
  • 1 tablespoon of black peppercorns
  • 1 teaspoon of ginger
  • A pot of boiling water filled about 1/3 – enough to cover the pork ribs

Cut the pork ribs into individual pieces. Throw into boiling water. Throw in everything. Cover, cook for 1 hour. If you lose water while cooking, just add more. No biggie. This is not a precise dish.

Give each person a bowl of soup with pork ribs.

Serve with steamed rice. Make soy sauce available to put in the soup or rice.

The above is super easy and very very tasty.

Ubuntu 11.10 Sound Blaster X-Fi ridiculous workaround

Posted: January 24th, 2012     Reminders to myself

Since I installed Ubuntu 11.10, my Sound Blaster X-Fi sound card stutters and doesn’t play back sound. The way to fix this is to open terminal and run “ubuntu-bug”. That’s it. Plays back fine until next reboot.

Ridiculous bug.

Steak on Mushrooms with Red Wine Sauce and Caesar Salad

Posted: January 15th, 2012     Food   Rambling   Reminders to myself

One of my new year resolutions in 2012 is to try a new recipe every weekend. I decided this weekend to try a steak on mushrooms with red wine sauce. I found this recipe on Epicurious and adapted it to stuff I could easily buy at the local grocery store. I also made a caesar salad from scratch. This serves as a reminder to myself so that I can cook the same thing again.

Steak on Mushrooms with Red Wine Sauce

  • 3 tablespoons extra-virgin olive oil
  • 12 ounces mixed mushrooms, cut up
  • Table salt
  • Ground black pepper
  • 4 tablespoons butter
  • 1.5 pounds steak
  • 3 garlic cloves diced
  • 1x 6″ sprig rosemary
  • 1 cup red wine
  • 3/4 cup chicken stock
Heat 2 tablespoons of olive oil in skillet on medium heat. Sautee mushrooms, put on some salt and pepper. Put aside.
Melt about 1 tablespoon of butter in the same skillet. Put in steak, garlic and rosemary. Cook roughly 3 mins per side, until medium rare. Transfer steak, garlic and rosemary to cutting board.
In the same skillet, put in wine. Boil for 3 mins. Pour in chicken stock. Bring to boil for about 5 mins, boiling it down. Mix in 3 tablespoons of butter. Put in mushrooms. Season with salt and ground black pepper.
Put mushrooms and some sauce onto serving plates. Slice meat. Put on top of mushrooms.
Eat with a good, hearty red wine. We had a cabernet savignon.
 
 

Caesar Salad from Scratch

This recipe is adapted from this one.
  • 2 egg yolks
  • 2 tablespoons dijon mustard
  • bacon bits (buy a packet)
  • 4 cloves chopped garlic
  • 4 tablespoons balsamic vinegar
  • 3 tablespoons lemon juice
  • dash of worcestershire sauce
  • 1 cup olive oil
  • 2-3 tablespoons of parmesan cheese
  • Romain lettuce
  • Croutons
Mix egg yolk, mustard, bacon, garlic, balsamic vinegar, lemon juice and worcestershire sauce in bowl. Slowly add olive oil while mixing. Add parmesan cheese.
Wash and chop romain lettuce. Spin in salad spinner.
Serve as a bed of lettuce and croutons. Let guests put on the dressing themselves.
The above is awesome. Very tasty caesar salad and much much better than store bought caesar dressing.

2012 Resolution: Retire Internet Explorer 8

Posted: December 31st, 2011     Rambling   Web Development

One of the biggest frustrations that I have as a professional web developer is Internet Explorer – more specifically IE8, which is currently refusing to die because it is “good enough but not quite”. Here we are, trying to move forward with new technology on HTML5 standards that work across most modern browsers, except things don’t look or work quite right in IE8. Corporations still give out computers to employees with IE8 pre-installed. Enough is enough. Let’s make 2012 the year that we, as a body of web professionals, begin to retire IE8.

How?

From now on, every site that I deliver for clients will have, by default, an IE8nomore header (or variant), which will only show up when a user with IE8 or less browses to the site. If a client specifically wants me to support IE8, they will need to pay extra for it. It’s that simple. Clients need to be educated that IE8 is just bad software. If they have the chance to tell you that a site you created doesn’t work in IE8, you’re too late. You need to put the header in by default so that when they, or their colleagues browse to your site, they immediately see that their browser is outdated. It’s psychological. They need to upgrade. You don’t need to lower your standards.

If you’re a professional web developer, make it your resolution. Let’s rid the world of standard-less browsers. Let’s nail IE8 and please be done with it.

Links

IE8nomore header
IE6nomore header (the original)

Rails, Bootstrap and will_paginate

Posted: December 29th, 2011     Reminders to myself   Web Development

If you’re using Ruby on Rails, you’ll likely use the will_paginate plugin. If you use Twitter’s Bootstrap CSS framework as well, you’ll notice that the pagination is all messed up. This gist fixes it:

  # application_helper.rb
  # https://gist.github.com/1205828
  # Based on https://gist.github.com/1182136
  class BootstrapLinkRenderer < ::WillPaginate::ViewHelpers::LinkRenderer
    protected
 
    def html_container(html)
      tag :div, tag(:ul, html), container_attributes
    end
 
    def page_number(page)
      tag :li, link(page, page, :rel => rel_value(page)), :class => ('active' if page == current_page)
    end
 
    def gap
      tag :li, link(super, '#'), :class => 'disabled'
    end
 
    def previous_or_next_page(page, text, classname)
      tag :li, link(text, page || '#'), :class => [classname[0..3], classname, ('disabled' unless page)].join(' ')
    end
  end
 
  def page_navigation_links(pages)
    will_paginate(pages, :class => 'pagination', :inner_window => 2, :outer_window => 0, :renderer => BootstrapLinkRenderer, :previous_label => '&larr;'.html_safe, :next_label => '&rarr;'.html_safe)
  end
 
Leonard Teo
CEO, Ballistiq
Montreal, Canada