First month in Sydney (Video)

Australia Immigration, Trips No Comments »

This is a video compilation of our first month living in Sydney, Australia.

Grails: Mocking localization in Controllers

programming No Comments »

If you are wondering how to mock the localizaton provider in a Grails Controller, these are two example on how to do it.

The first one  (FooController) is used when you want to have an instance of MessageSource injected as a member of your controller.

class FooController {
  def messageSource

  def index = {
    def someMessage = messageSource.getMessage("some.key")
    log.debug("Localized message: " + someMessage)
    render(someMessage)
  }
}

And its test class:

class FooControllerTests extends ControllerUnitTestCase {
  void testIndex() {
    //controller.messageSource = [getMessage: { def key, def locale -> return key }]
    controller.messageSource = [getMessage: { def key -> return key }] //returns the input key
    controller.index()
    assertEquals "Should return a localized key", "some.key", controller.response.contentAsString
  }
}

The second one (BarController) is when you prefer to use the “message” closure:

class BarController {
  def index = {
    def someMessage = message(code: "some.key", default: "Some default message")
    log.debug("Localized message: " + someMessage)
    render(someMessage)
  }
}

Finally, how to mock it:

class FooControllerTests extends ControllerUnitTestCase {
  void testIndex() {
    //controller.messageSource = [getMessage: { def key, def locale -> return key }]
    controller.messageSource = [getMessage: { def key -> return key }] //returns the input key
    controller.index()
    assertEquals "Should return a localized key", "some.key", controller.response.contentAsString
  }
}

Quick and simple. I hope you enjoy these simple and useful examples.

Exception Handling vs. Reflection calls. Wich is more expensive?

programming 2 Comments »

In terms of performance, it is well known that Reflection Calls and Exception Handling are some of the most expensive operations in a programming language.
However, which of them is more expensive?

It only makes sense to compare the performance of these two mechanisms, if you have a situation on where one can replace the other. I have to admit that if a problem can be solved with Reflection or Exceptions, then the solution for this problem smells very bad.
That is exactly the situation which brought up this question, a stink code. My team is working with the NVelocity library, a version of the popular Java Template Engine, ported to MS .Net. This lib makes extensively use of the Code by Exception anti-pattern and refactoring its code is not an option due to the lack of time.
It is weird, but in that code there is a comment suggesting that a reflexive call could avoid a Exception Raising/Handling.

I don’t know about you, but I was surprised by the result. A reflexive call is 5 times faster than an Exception raising and handling.

The following code (in CSharp) runs a Reflexive call and an Exception raising/handling 10.000 times.

Read the rest of this entry »

Practicing the Australian accent

Australia Immigration 2 Comments »

I thought I was able to understand any English accent in the world, since I work with Americans, Indians, Chinese and off course, Brazilians.  Poor guy It was until I started having to argue with Australians.
The Australian accent is so different in a variety of aspects: fresh new slang, completely different pronunciation,  an intonation which makes their sentences sound like questions, vocabulary, etc.

I realized it would be prudent if I had some training on this new stuff, before arriving there.

So, there is it. These are the resources which are helping me to enhance my Australian Communication Skills.

Accent

Although listening to radios is not the best way to learn their accent, due to the very clear English the radio professionals speak, it is still an alternative. Specially because you some of them allow you to download their Podcasts and listen everywhere.
Follow my preferred radios:

Australia Now
Talks about Australian culture, geography, immigration and politics.

http://www.abc.net.au/ra/podcast/australianow/podcast.xml

Tech Stream
The subject here is technology.
http://www.abc.net.au/ra/podcast/techstream/podcast.xml

AUS Radio Stations.com
It is a list of all OZ radio stations

http://www.ausradiostations.com/

Radio Australia Podcasts
http://www.radioaustralia.net.au/subscribe/

Youtube
Browse for Australian Accent.
http://www.youtube.com/results?search_query=australian+accent

The Angy Aussie. Not that I really enjoy all that  he says, but it  is a really rich source of vocabulary and the channel is updated very often.
http://www.youtube.com/user/AngryAussie

Slang
http://www.upfromaustralia.com/aussieslang.html

Can’t login after upgrading Wordpress to 2.9.2

Geek 1 Comment »

After upgrading Wordpress to 2.9.2, I wasn’t able to login at the admin page of this blog.
By disabling all plugins I was able to login again. After that , I have enabled every single plugin, one by one,  until a found out that qTranslate was the cause of this failure. (Google for “Disabling Wordpress plugins” if you don’t know how to do that).

A few hours after Googling for a fix, I couldn’t find any useful information. However, this error happened with me in the past and it as due to the desynchronization of the “AUTH_KEY”  on wp-config.php file and the “wp_default_secret_key” in my language file (wp-content/languages/en_US.php).

I went to the en_US.php file and it was ok, the keys were equals. So I deleted this file, just to see what would happens. Voilá! It was working again.

So, the fix is as simple as:

rm /<installation folder>/wp-content/languages/en_US.php

Kitesurfers jumping a pier

Kiteboarding No Comments »

Nice video of some friends jumping a pier, during a competition, in Atlântida beach, one of my favorite kite spots.

IELTS Study Guide

Australia Immigration No Comments »

This is a quick guide on how to prepare yourself to take the IELTS, based on my own experience.

Overview

I don’t think taking classes is really necessary. If you have discipline, the entire preparation can be made through books. On the other hand, if you have time and money, an English Teacher is definitely the better alternative.
I do English classes in a regular basis  and I had 8 months to do the test, so I did 8 months of English classes focused on IELTS.

Read the rest of this entry »

Marketcetera review

Trading No Comments »

This is a quick review of the Marketcetera Automated Trading System.

Pros:
- Youtube channel with a lot of usefull Screencasts
- Active community and forum.
- Easy to install on Windows machines, trough and .exe that comes with all you need.
- View and Model Layers are decoupled. You can run it in a server and access it remotely or locally via the GUI, called Photon.
- Uses the FIX standard protocol.
- Has a Fix simulator at http://exchange.marketcetera.com/marketDisplay
- Built in Java, which means it runs in any platform and is highly extensible.
- It us Open Source with paid support. It means that if you are running it with real money and you have a problem, you have someone to hire and fix it.
- The Strategies can be written in Java and Ruby.
- Strategies can be rapidly coded inside of Photon or in any Java IDE.
- The graphical interface (Photon) is based on Eclipse RCP

Cons:
- Doesn’t work with Proxy Connections.
- Doesn’t have a Realtime Graph (It has a JFreechart plugin to generate (poor) graphs. It would be nice to get the Graphs from EclipseTrader and integrate on Marketcetera.
- Difficult to Backtest based on CSV files. (It requires a plugin)
- Does not support protocols other than FIX.

How to produce T-shirts

Geek 2 Comments »

Introduction

I have started thinking about producing some Kiteboarding T-Shirts and perhaps start a small Kite Wear Company about six months ago. As a software developer, I am comfortable with computers and I thought I could do the designs myself, after watching some Illustrators Tutorials on the internet. I quickly realized that I was completely wrong. I have no skills neither talent to create artistic designs. Thus, I went to the Auto Tracing Tools, such as Corel Trace and some others.
Their result were even worse than my manually generated designs.
I had no choice, if I wanted to produce high quality t-shirts, I would have to hire a professional designer.

I did some budged estimates and I almost gave up due to the high cost to produce a vector design. It was about U$100,00.  To be honest it is not  that expensive for an established company. However, I don’t have a company, I was not even thinking about opening one. I was willing to produce small quantities of 5 or 10 different designs. In this case, the U$100,00 for images would be too expensive.
In order to produce T-shirts with good quality and an affordable price, we have to find and talented and affordable  designer and a base image to start.

Requirements

This paragraph is to explain what are the requirements involved in the life-cycle of the t-shirt production, such as tools, prototyping, vectorization, printing, colors, fabric types and cuts.

Read the rest of this entry »

Arduino potentiometer sensor

Arduino No Comments »

Plug it and Arduino read rotation !

This post is a copy of the Original post on EBay. I am replicating it here because ended items on Ebay are not indexed by Google, the author’s page is written in Chinese and doesn’t contains the Source code. If you are the author and you are obset with this, please get in touch.

This Potentiometer module is a simple knob that provides a variable resistance, which we can read into the Arduino board as an analog value. By turning the shaft of the potentiometer, we change the input signal to analog pin.

Building interactive work is as easy as piling bricks, just plug it to our Arduino Sensor Shield with a buckled cable, and make it looks professional and neat.

Read the rest of this entry »

WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in