[my weblog] [my software] [contact me]

h3's weblog

(garbage in, garbage out)

 

11 august 2008

IM me from the web

If you want to chat with me just click below :)

 
 

08 june 2008

I.T. Salaries

Sadly, in Italy you must divide this by 2 or 3...
 
 

20 may 2008

My new remix

You can listen it here in streaming:

FoalsElectric Bloom (h3-r3 remix)

or downlad the MP3

If you are a Last.fm user please scrobble it!!
 
 

23 december 2007

J2ME rotozoomer

Today I tried to code an oldschool demo effect for my mobile phone (a Nokia 3110 classic)...
I created a simple rotozomeer :)

here is the code (J2ME MIDP 2.0)

package org.postronic.h3.testmidlet;

import javax.microedition.lcdui.Display;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;

public class RotozoomerMIDlet extends MIDlet {

  public RotozoomerMIDlet() { }

  protected void startApp() throws MIDletStateChangeException {
    RotozoomerCanvas canvas = new RotozoomerCanvas();
    Display display = Display.getDisplay(this);
    display.setCurrent(canvas);
    canvas.run();
  }

  protected void pauseApp() { }

  protected void destroyApp(boolean arg0) throws MIDletStateChangeException { }

}



package org.postronic.h3.testmidlet;

import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;
import javax.microedition.lcdui.game.GameCanvas;

public class RotozoomerCanvas extends GameCanvas {

  protected RotozoomerCanvas() {
    super(true);
    setFullScreenMode(true);
  }

  public void run() {
    int imgWidth = getWidth();
    int imgHeight = getHeight();
    Graphics g = getGraphics();
    int[] img = new int[imgWidth * imgHeight];

    Image texture = Image.createImage(32, 16);
    Graphics tg = texture.getGraphics();
    tg.setColor(200, 200, 255);
    tg.drawString("h3-r3", 2, 0, Graphics.TOP | Graphics.LEFT);
    tg.setColor(200, 200, 255);
    tg.drawString("h3-r3", 4, 0, Graphics.TOP | Graphics.LEFT);
    tg.setColor(0, 0, 255);
    tg.drawString("h3-r3", 3, 0, Graphics.TOP | Graphics.LEFT);
    int[] txImg = new int[32 * 16];
    texture.getRGB(txImg, 0, 32, 0, 0, 32, 16);
    texture = null; // dispose the texture Image

    float tx, ty;
    float dtx, dty;
    float otx, oty;

    double cont = 0;
    double cos, sin;
    double size;
    int offs;
    for(;;) {
      cos = Math.cos(cont);
      sin = Math.sin(cont);
      tx = (float) cos * 20;
      ty = (float) sin * 20;
      size = cos;
      dtx = (float) (cos * size);
      dty = (float) (sin * size);
      cont += 0.02;
      for (int y = 0; y < imgHeight; y++) {
        otx = tx;
        oty = ty;
        offs = y * imgWidth;
        for (int x = 0; x < imgWidth; x++) {
          img[x + offs] = txImg[((int)(tx) & 31) + (((int)(ty) & 15) * 32)];
          tx += dtx;
          ty += dty;
        }
        tx = otx - dty;
        ty = oty + dtx;
      }
      g.drawRGB(img, 0, imgWidth, 0, 0, imgWidth, imgHeight, false);
      flushGraphics();
    }
  }

}

 
 

16 december 2007

Outrun

 
 

08 december 2007

For he's a jolly good microcomputer

25 years and we are still good friends :)

Good anniversary Commodore 64
 
 

29 november 2007

Google Groups inner workings

Some days ago I was browsing some Google Groups. Then this page came out:

<html>
  <head>
   <title>Error: Exception thrown while generating page</title>
  </head>
  <body>
   <h2>Error: Exception thrown while generating page</h2>
   <pre>
    java.lang.OutOfMemoryError: MemoryError: Unable to resize ULIST to 20: Out of memory
    at org.clearsilver.CS._parseFile(Native Method)
    at org.clearsilver.CS.parseFile(CS.java:58)
    at com.google.clearsilver.base.PageBase.go(PageBase.java:486)
    at com.google.clearsilver.base.PageServlet.handleRequest(PageServlet.java:44)
    at com.google.clearsilver.base.PageServlet.doGet(PageServlet.java:33)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    at com.google.gse.HttpConnection.runServlet(HttpConnection.java:534)
    at com.google.gse.HttpConnection.run(HttpConnection.java:458)
    at com.google.gse.DispatchQueue$WorkerThread.run(DispatchQueue.java:299)
   </pre>
  </body>
</html>


This is very interesting for two reasons:
  1. Shows that even at Google they are human and make mistakes. Having some exceptions is ok,
    but they should be catched, logged internally and not shown directly to the user, or at least the stack
    trace should be hidden.
  2. Reveals some inner workings of a state of the art Web 2.0 application
    such as Google Groups.

Here is what you can learn from this stack trace:
  • They are using Java
  • Regular Servlets
  • ClearSilver as template engine
  • They built a framework based on ClearSilver
  • They use their own application server, called GSE... what is it for? Google Server Engine? Google Servlet Engine? who knows...
 
Links:
Syndications:
XML RSS feed
XML RSS comments feed
Klip Klipfolio Klip
Klip Comments Klip

Blog friends: