Stoppt die Vorratsdatenspeicherung! Jetzt klicken & handeln!Willst du auch bei der Aktion teilnehmen? Hier findest du alle relevanten Infos und Materialien:

Bildschirmplatz sparen bei maximiertem Fenster

January 17, 2011 on 2:58 pm | In linux, open source, ubuntu | No Comments

Endlich habe ich eine gute Methode gefunden etwas Platz für maximierte Fenster auf dem Gnome Desktop zu sparen. Auf dem folgenden Bild fehlt die Titelleiste des EMACS Fensters. Dafür gibt es im oberen Panel die drei typischen Windows Buttons ( schließen, minimieren und verkleinern )


Ubuntu screen with maximized window and gnome-window-applet

Die Installation mit “apt-get” ist wie immer recht einfach. Die folgenden beiden Zeilen in eine Shell eingeben und danach das Widget “Windows Buttons” in das Panel seiner Wahl einfügen.

sudo add-apt-repository ppa:tsbarnes/misc
sudo apt-get update && sudo apt-get install gnome-window-applets

Nun sollten die drei typischen Windows Buttons in dem Panel erscheinen, wenn ein Fenster maximiert wird.

Danach muss mit dem CompizConfig Manager eine Eigenschaft von
“Effekt->Fenster ein-/ausblenden” geändert werden.

Die Eigenschaft “Dekoration für Fenster” muss auf “!state=maxvert” gesetzt werden ( siehe unteres Bild ).


Ubuntu screen with maximized window and gnome-window-applet

Falls der CompizConfig Manager noch nicht installiert ist, kann dies mit der folgenden Zeile nachgeholt werden,

sudo apt-get install compizconfig-settings-manager

Ubuntu 9.10 and the Google Go Emacs Mode

November 24, 2009 on 1:00 pm | In english, hacking, linux, open source, technic | No Comments

After some hours with google go I recognize the emacs mode in the source directory of the current distribution.

It is easy to install the mode for ubuntu 9.10 (karmic). First install the emacs with

sudo apt-get install emacs23

After that copy the the two .el files from you google ~/go/misc/emacs directory to

/usr/share/emacs/23.1/lisp

Now create a .emacs file in you home directory and add the following to lines.

(add-to-list ‘load-path “/usr/share/emacs/23.1/lisp” t)
(require ‘go-mode-load)

Now the google mode is activated after loading a .go file.


Emacs with go mode





Google Go and the Mandelbrot Set Part II

November 17, 2009 on 12:22 pm | In english, hacking, linux | No Comments

The following code is my solution for parallel calculation of a mandelbrot set with google go.

package main

import ( "image";
        "image/png";
	"bufio";
	"fmt";
	"os";
	"math";
	"time"; )

type PixelCalc struct {  x int;
     	                 y int;
                         cx float64;
	                 cy float64; }

func PointIteration(in chan *PixelCalc,ready chan int,img *image.RGBA){

	for {
		pixelCalc :=  <- in; 

		xt := float64(0);
		yt := float64(0);
		x := float64(0);
		y := float64(0);
		quadValue := float64(0);
		iter := 0;

		for quadValue <= 255.0 && iter < 255 {
			xt= ( x * x ) - ( y * y) + pixelCalc.cx;
			yt= ( float64(2.0) * x * y ) + pixelCalc.cy;
			x = xt;
			y = yt;
			iter++;

			quadValue = ( x * x ) + ( y * y );
		}

		color := new(image.NRGBAColor);
		color.A = 255;
		iter8 := uint8(iter);
		color.R = iter8;
		color.G = iter8;
		color.B = iter8;
		img.Set(pixelCalc.x,pixelCalc.y,color);

		ready <- 1;
	}
}

func main(){
	start := time.Seconds();

	const pictureSize = 1000;

	img := image.NewRGBA(pictureSize,pictureSize);

	f, err := os.Open("mandel.png", os.O_WRONLY|os.O_CREAT, 0666);
	if err != nil {
		fmt.Printf("Can't create picture file\n");
	}

	calc := make(chan *PixelCalc,pictureSize*pictureSize);
	out := make(chan int,pictureSize*pictureSize);

	for i:=0;i<4;i++{
		go PointIteration(calc,out,img);
	}

	deltaX := math.Fabs(float64(-2.0 - 1.0)) / float64(pictureSize);
        deltaY := math.Fabs(float64(-1.0 - 1.0)) / float64(pictureSize);

	cx := float64(-2.0);

	for x:=0;x<pictureSize;x++{
		cx+=deltaX;
		cy := float64(-1.0);

		for y:=0;y<pictureSize;y++{
	    		cy+=deltaY;
			pixelCalc := new(PixelCalc);
			pixelCalc.cx = cx;
			pixelCalc.cy = cy;
			pixelCalc.x  = x;
			pixelCalc.y  = y;

			calc <- pixelCalc;
		}
	}	

	for i:=0;i<pictureSize*pictureSize;i++{
		<- out;
	}

  	w := bufio.NewWriter(f);
	png.Encode(w,img);
	w.Flush();

	fmt.Printf("Seconds needed %d\n",time.Seconds() - start);
}

At this time the go compiler has some bugs regarding the multiprocessor support. But sometimes I can see the use of my two processors.

processor load

I hope there will fix that bug fast. The first workaround for that bug is the GOMAXPROCS environment variable. I set this to 2. But this did’nt help everytime.

Link to part 1





Google Go and the Mandelbrot Set

November 13, 2009 on 12:30 pm | In english, hacking, linux | 1 Comment

Learning a new programming language is fun. Here is my version of calculating the mandelbrot set and save the result as a PNG picture with Google Go.

package main

import (   "image";
           "image/png";
           "bufio";
	   "fmt";
	   "os";
           "math";
           "time"; )

func PointIteration( cx, cy, maxValue float64, maxIter uint8) uint8{
     quadValue := float64(0.0);
     iter := uint8(0);
     x := float64(0.0);
     y := float64(0.0);

    for quadValue <= maxValue && iter < maxIter {
        xt:= ( x * x ) - ( y * y) + cx;
        yt:= ( float64(2.0) * x * y ) + cy;
        x = xt;
        y = yt;
        iter++;
        quadValue = ( x * x ) + ( y * y );
    }
    return iter;
}

func main(){
    start := time.Seconds();     

    const pictureSize = 500;
    img := image.NewRGBA(pictureSize,pictureSize);

    f, err := os.Open("mandel.png", os.O_WRONLY|os.O_CREAT, 0666);
    if err != nil {
       fmt.Printf("Can't create picture file\n");
    }

    deltaX := math.Fabs(float64(-2.0 - 1.0)) / float64(pictureSize);
    deltaY := math.Fabs(float64(-1.0 - 1.0)) / float64(pictureSize);

    cx := float64(-2.0);
    for x:=0;x<pictureSize;x++{
        cx+=deltaX;
        cy := float64(-1.0);
        for y:=0;y<pictureSize;y++{
           cy+=deltaY;
           iter := PointIteration(cx,cy,255.0,255);

           color := new(image.NRGBAColor);
           color.A = 255;
           color.R = iter;
           color.G = iter;
           color.B = iter;
           img.Set(x,y,color);
	}
     }

     w := bufio.NewWriter(f);
     png.Encode(w,img);
     w.Flush();

     fmt.Printf("Seconds needed %d\n",time.Seconds() - start);
}

And here the result. :-)

Mandelbrot Set - calculated with google go

Next step is trying to improve the speed by using goroutines and channels.





We’re Linux - Video Contest Winners

April 15, 2009 on 9:41 am | In linux, open source | No Comments

Obwohl die Linux Foundation diesen Film als Gewinner des Linux Video Contest ausgeschrieben hat, muss ich mich dieser Entscheidung ja nicht anschließen und zeige hier einfach den zweiten Platz. Der gefällt mir persönlich sehr viel besser.



Next Page »

Powered by WordPress with Pool theme design by Borja Fernandez.
Entries and comments feeds. Valid XHTML and CSS. ^Top^