What is Google up to?

This week I've stumbled over two unrelated blog posts.

  • DNS Prefetch in Webmail:

    When you view an email in Mozilla Thunderbird, it looks at each of the URLs in the body, and does a DNS lookup on each of the domains. It does this so the page loads faster if you click on the link. [...] Worryingly, this issue also affects viewing email in webmail clients. I tested it using hotmail and gmail and both did DNS prefetching on the URLs in the email body. Using HTTPS rather than HTTP disables DNS prefetching. Luckily for GMail users, they recently made all requests HTTPS by default.

  • Google wants to see client addresses in DNS queries:

    Google employees posted an "Internet-Draft" outlining proposed changes to the DNS protocol that allow authoritative DNS servers to see the addresses of clients. This way, geographically distributed content delivery networks can tailor their answers to a specific client's network location.

Hope the HTTPS holds. But for sure, this does raise my eyebrows makes me shiver.

Scala Goodness: Extractors

One Scala goodness is the unapply method to extract values.

Suppose we want to match a string if it does contain DogFood. In Scala we can use an object or class with an unapply method, which takes the input we try to extract values from and returns the extracted value. Because there needn't be a match in every case, the value is wrapped in an Option. A simple extractor for DogFood might look like this:

object DogFood {
  def unapply(f:String):Option[String] = 
    if (f=="meat") Some("MEAT!") else None
}

// Prints "Yeah MEAT!"
"meat" match { 
  case DogFood(f) => println ("Yeah " + f) 
  case _ => println ("Bah")
}
// Prints "Bah"
"fruit" match { 
  case DogFood(f) => println ("Yeah " + f) 
  case _ => println ("Bah")
}

The unapply method can be used in more contexts. Another usecase is to filter for comprehensions. The same DogFood object from above can be used to filter a list of Strings and only return Strings that contain dog food:

scala> val foods = List("meat","fruit","grain")
foods: List[java.lang.String] = List(meat, fruit, grain)

scala> for (DogFood(f) <- foods) yield f
res29: List[String] = List(MEAT!)

Unapply can extract more than one value. In such a case, the method needs to return a Tuple (Javaish):

case class Food(food:String)
case class Name(name:String)

object Dog {
  def unapply(desc:String):Option[(Name,Food)] = {
    val i=desc.indexOf(" eats ") 
    if (i> -1) 
      Some((Name(desc.substring(0,i)), Food(desc.substring(i+6)))) 
    else None
  }
}

We can now use the Dog object to extract more than one value:

scala> "Brutus eats meat" match { case Dog(f,n) => (f,n) }
res5: (Name, Food) = (Name(Brutus),Food(meat))

This also works for assignment, just as with Tuple assignment:

scala> val Dog(f,n) = "Brutus eats meat"
f: Name = Name(Brutus)
n: Food = Food(meat)

Extractors in Scala even work with Squences. For an example see Daily Scala, a wonderful blog with Scala tips.

See also:

Top 10 Tips (+1) to Get a Pay Raise

My tips may sound obvious, but I was always astonished why some people came to me for more money. They wanted more money for showing up and getting older. There are some general rules when asking for a pay raise, like companies giving out raises only once a year. Some of them can be found here and here.

My general rule: If you did not change in any way in the last year, it's not very probable you get a pay raise and more money (sometimes a company changed significantly to give pay raises, startups for example). Make yourself more valuable. Self promote more, write some articles or give speeches at conferences. That said, here come the tips.

Top 10 Tips to Get More Money


  1. Ask what to do to get a raise.
    Your boss knows best when he want's to give you a raise. So better ask him if you want one.
  2. Ask!
    If you do not ask for more money, you will most probably not get more money. In the past I've got sometimes more money, because my employeer feared to lose me, but otherwise: No asking, no pay raise.
  3. Go Extra Mile
    Managers will easier award more pay to people who go the extra mile. If you're in the head of your boss as "the maker" or the one who goes the extra mile, it will be much easier for your boss to give you more money. Make it easy for him.
  4. Help your Boss
    One of my mottos always was: Help your boss. Just once think about him, his problems, what he needs to get going and what he needs solved. Most of your bosses have bosses of their own for whom they must achieve things. If you help your boss, he usually will help you. Which might be a pay raise.
  5. Accept new Responsibilities
    Take a look at your responsibilities. Where do you want to go? Accepting more or new responsibilities gives you better arguments for a pay raise.
  6. Manage People
    If you currently do not manage people (whatever that means), one way to earn more money is start with a managing role. Companies can easier accept giving you a pay raise if you have the responsibility for people. Be sure that you really want this, don't do it just for the money. Otherwise you're the next PHB.
  7. Change Jobs
    The easiest way and the hardest way to get more money is to change jobs. With the insecurity of a new job, the change, more responsibilities (see above) this can be a fearful experience, and you also shouldn't change jobs too often. This is the hard part. The easy part: Your new boss most certainly will see it as natural that you want more money in your new job than in your old one. He needs to woo you away from your old job.
  8. Learn new Skills
    As said, if you do not change, your pay won't change also. Expand your skills, either on a new project at work or learning at home. With the internet there is no excuse anymore to not learn something every day. As Lisa Barone writes in "It’s Not the Recession, You Just Suck":

    Learn something new. Go beyond your bubble and learn how to do something that makes you stand out.

  9. Ask for new Hardware or other Benefits
    The budget of your boss on payments might be tight. Often it's easier for him and your company to give you hardware or other benefits instead of money (see below about bonuses). I would ask for money first, and if your boss sees no budget, ask about new hardware.
  10. Ask for a Bonus
    Sometimes there is no budget for a pay raise. But there may be money for a bonus. Ask what you need to do to earn a bonus or take a look at what you have achieved. Bonuses are both easier to your company as they are not permanent and are based on precise conditions.
  11. Bonus: Know What You're Worth
    You should know what you are worth - look around or get competing bids. Daiv Russel tweets:

    @codemonkeyism Get competing bids from other companies to convey you market value to your employer

    This makes it easier to argue for more money with your boss. Take into account your local pay range and the pay range at your company. Startups may pay less, trans-nationals may pay more. Prepare for a rude awakening, you might be at the top already.

If all of this doesn't work, and competing companies pay more, then perhaps you are really at the wrong company. But do not base your happyness on money alone, there could be a rude awakening. I wish you the best!