Archive for June, 2008

D’ale carnavalului

Posted on June 30th, 2008 in Events, life, people | No Comments »

Nea Nelu loveste din nou:

Iliescu despre Dancu: “Sta, suge din deget si emite fraze teoretice”.

Iliescu le-a recomandat tuturor celor care au obţinut rezultate proaste la locale „să stea cu picioarele în lighean” şi să analizeze „cu toată seriozitatea ce se întâmplă”.

via gandul

My way

Posted on June 16th, 2008 in life, me, music | No Comments »

For what is a man, what has he got?
If not himself, then he has naught.
To say the things he truly feels;
And not the words of one who kneels.
The record shows I took the blows -
And did it my way!

Hybrid boom box

Posted on June 11th, 2008 in cars, tech | 3 Comments »

Am I the only one who thinks that this is a stupid, time wasting idea?

JQuery around the globe

Posted on June 9th, 2008 in programming, tech, web | No Comments »

Recent John Resig’s speaches :

  1. jQuery (BarCamp Boston)
  2. Processing and Processing.js (BarCamp Boston)
  3. jQuery (MeshU)
  4. Managing the Mozilla Way (Slashdot, ITWorld)
  5. jQuery (DrupalCamp Toronto)
  6. JavaScript 1.5 to 2.0
  7. JavaScript Libraries (Kings of Code)
  8. JavaScript Libraries (@Media)
  9. jQuery (BostonPHP)

demo used:

via John Resig

21

Posted on June 6th, 2008 in me, movies | No Comments »

How many lives do we live?

How many times do we die?

They say we all lose twenty-one grams…

at the exact moment of our death.

Everyone.

And how much fits into thenwty-one grams?

How much is lost?

When do we loose twenty-one grams?

How much goes with them?

How much is gained?

….How….  much is gained?

Twenty-one grams.

The weight of a stack of five nickles.

The weight of a humming bird.

A chocolate bar.

How much do twenty-one grams weight?

Java Servlets - Filter example

Posted on June 6th, 2008 in programming | No Comments »

A little filter that detects if the The X-Forwarded-For (XFF) HTTP header is set.
If it’s set it means that the call arrived trough a proxy, and when the “getRemoteAddr()” method is called by the server it will return the last proxy in the IP array.
So basicly what this does is (if XFF is set) forces the “getRemoteAddr()/getRemoteHost()” methods to always return the first IP in the XFF header.

Here’s the filter class:

public final class EditHeader implements Filter {

private FilterConfig filterConfig;

public void init(FilterConfig filterConfig) throws
ServletException {
System.out.println("Filter initialized");
this.filterConfig = filterConfig;
}

public void destroy() {
System.out.println("Filter destroyed");
this.filterConfig = null;
}

public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain)
throws IOException, ServletException {

chain.doFilter( new MyWrapper((HttpServletRequest) request), response);
}

}

Here you have the filter wrapper class:

public final class MyWrapper extends
        HttpServletRequestWrapper {
    public HttpServletRequest httpRequest = (HttpServletRequest) super.getRequest();
    public String reqAddr = httpRequest.getRemoteAddr();
    public String reqHost = httpRequest.getRemoteHost();
    public MyWrapper(HttpServletRequest servletRequest) {
        super(servletRequest);
   }
    public String getRemoteAddr() {
        String callerChain = httpRequest.getHeader("X-Forwarded-For");
        if (callerChain==null ||callerChain.equals(""))
            return reqAddr+"abc";
        StringTokenizer tempStringTokenizer = new StringTokenizer(callerChain, ",");
        return (tempStringTokenizer.nextToken());
    }
    public String getRemoteHost() {
        String callerChain = httpRequest.getHeader("X-Forwarded-For");
        if (callerChain==null ||callerChain.equals(""))
            return reqHost+"def";
        StringTokenizer tempStringTokenizer = new StringTokenizer(callerChain, ",");
        return (tempStringTokenizer.nextToken());
    }

And here’s a little test servlet :


public class test extends HttpServlet {
    public void doGet(HttpServletRequest req, HttpServletResponse res)
            throws ServletException, IOException {
        res.setContentType("text/html");
        PrintWriter out = res.getWriter();
        out.println("");
        out.println("Test");
        out.println("");
        out.println("Caller Host  :" +req.getRemoteAddr() + "");
        out.println("Caller Addr  :" + req.getRemoteHost() +"");
        out.println("");
    }
}

The web.xml looks like this :



      EditHeader
      EditHeader
   

      EditHeader
      test
   
	
        test
        test
    
    
        test
        
            test
        
    

Docs:

http://java.sun.com/products/servlet/Filters.html
http://www.onjava.com/pub/a/onjava/2004/03/03/filters.html
http://www.developer.com/java/ent/article.php/3467801

Last m&m in the bag

Posted on June 6th, 2008 in Events, me | 2 Comments »

M&M’s … my recent favourite 5 minute break snack! I always want more and finished quick … BUT TODAY …. after i finished up (so i tought) a little bag ( 20 candies or so)… I left it on the desk … and after 15 minutes picked it up and for my surprise there was one more m&m there …. justy laying there… a little red ball of juicy chocolate :)) That was the most tasty m&m I ever ate. THE END! (stupid post :) )

azi ascultam:

Posted on June 6th, 2008 in music | No Comments »

oh girl!!

Posted on June 6th, 2008 in humour | No Comments »

Movie review - The bank job(2008)

Posted on June 3rd, 2008 in movies | 1 Comment »

Between work, work, graduation paper work, work, some jogging, and all the South Park (note: I’m not watching them online since my conection at home doesn’t exceed 6 Kbps :( ) eppisodes that i’m re-watching, I managed to watch The bank job(2008) starring (one of my favourites actors) Jason Statham.

Based on a “true story of a heist gone wrong… in all the right ways” in 1970s, it has it all: british accent (brits do it better!), some action, some naked scenes :), ’70s ambient and a lot more.

However i think that the 107m:03s spent watching it were not a waste of time.

Cheers