
Latest Entries »
When I was about 8 years old, I remember having this thought about what would happen if nothing relevant happened all the day long and the newspapers didn’t have nothing to write about. I now know that would never be possible because newspapers would just create something interesting to talk about.
But yesterday I tasted something similar. I didn’t receive one single e-mail all day long. Besides the ones I kept sending myself (just to make sure my e-mail system was ok) and the always flowing current of spam, I didn’t get one single e-mail. Not even from mailing lists. Weird …
Apparently , today everything is back normal!
Update: I just found an explanation to what happened. I had around 300 e-mails per day in my spam folder so it was not funny to dig for false positives. This spam issue is starting to get out of hand.
Sorry about the stupid post. To understand this one you have to be understand Portuguese, know SQL and watch a certain comedy sketch show.
CONNECT aldeia; SELECT * FROM pessoa WHERE altura =ALL (SELECT MAX(altura) FROM pessoa);
So much time without a single post and this was all I could come up with. Sad …
Been playing around with AspectJ and just made my first, not so simple, AspectJ code and it works like a charm. There are still some things that I don’t fully understand but it’s late so maybe tomorrow I’ll get it.
Follow the read more link to see the source code for my Generic ObserverPattern implementation.
import java.util.Vector;
import java.util.Iterator;
public abstract aspect ObserverPattern perthis(subjectConstructed(Subject))
{
public interface Observer { }
public interface Subject { }
Vector observers = new Vector();
public void addObserver(Observer o)
{
observers.add(o);
}
protected pointcut subjectConstructed(Subject s) :
execution(Subject+.new(..)) && this(s);
abstract protected pointcut subjectChanged(Subject s);
after(Subject s) : subjectChanged(s)
{
Iterator itr = observers.iterator();
while (itr.hasNext())
updateObserver((Observer)itr.next(), s);
}
public abstract void updateObserver(Observer o, Subject s);
}
PointObserverPattern.java
public aspect PointObserverPattern extends ObserverPattern
{
declare parents: Screen implements Observer;
declare parents: Point implements Subject;
protected pointcut subjectChanged(Subject s) :
execution(void Point.set*(..)) && this(s);
public void updateObserver(Observer o, Subject s)
{
((Screen)o).updateDisplay();
}
}
Point.java
public class Point
{
private float x;
private float y;
Point (float x, float y)
{
this.x = x;
this.y = y;
}
public void setX(float x){
this.x = x;
}
public void setY(float y){
this.y = y;
}
}
Screen.java
public class Screen
{
public void updateDisplay(){
System.out.println("Display has been updated");
}
}
Application.java
public class Application
{
public static void main(String[] args) {
Point p = new Point(0,0);
Screen s = new Screen();
PointObserverPattern.aspectOf(p).addObserver(s);
p.setX(2);
p.setY(2);
System.exit(0);
}
}
… I’m done with writing it. Now I just need to proof read it.
I know it has been a long time since my last post. I hope to have some more time from now on.






