Computer-Ag am WvS Blog der Computer-AG am Werner von Siemens Gymnasium Berlin

20. Februar 2015

20.2.2015

Filed under: Allgemein,Pizza,Tagesberichte,Termine,Tisch — admin @ 15:38

Angelo ist da. Robert holt sich bei bitbucket einen Account mit Namen frankxy und bitbucket@sauer-ernst.de. Mit git clone https://frankxy@bitbucket.org/frankxy/tracker.git
lässt sich das Repository klonen.

Gitbefehle, die nötig waren:

touch test.txt

git status

git add test.txt

git commit

git push

Mit Bitbucket und Phonegap funktioniert das so: https://www.monkehworks.com/using-private-bitbucket-repositories-with-phonegap-build/.

Angelo ist mit seinem Gras (GTA) zufrieden. Morten ist nicht da. Angelo wollte irgendwann Pizza machen. Den Teig macht er wie in der Freakshow angegeben.

Das Video-Tutorial zu Phonegap kann man hier in der Schule nicht hören, weil die Monitore keine Boxen haben.

Unten im kleinen Chor wird der Song „Hungriges Herz“ gesungen (bekannt aus der Werbung).

Angelo kriegt sein Grün mittlerweile fast so hin wie auf der PS2 (Screenshot vom Emulator).

Mit „git gui“ kriegt man auch ne Git-GUI. Mehr zu GIT (sprich: git, nicht dschid) gibts bei Wikipedia.

Für First-Steps mit Phonegap finden sich einige Tutorials, u.a. das hier.

Und das hier auch (das ist aber das gleiche wie oben im Prinzip, auch von coenraets).

Heute machen wir früher Schluss. Angelo kam nicht an die DVD-Laufwerke ran, weil man da die Front abbauen muss. Morten ist verschollen. Dafür sind die Alphas bei Angelo jetzt passabel. Und das Gras ist auch richtig. Aber seine SSH-Verbindung bricht nach 10 Sekunden immer ab, oder etwas mehr. Und jetzt, wo sie hält, machen wir Schluss.

Nächsten Mittwoch ist normal, und dann klären wir einen Termin fürs Pizzaessen.

 

 

 

18. Februar 2015

18.2.2015

Angelo, Moritz, Morten und Julian sind da. Johannes kann nicht. Angelo arbeitet am Gras vom PC-GTA.

Robert recherchiert mal wieder wegen App-Entwicklung. Dazu findet sich ein Selfhtml-Thread. Bei der Hamburger Appwerft gibt es einen Artikel zu Phonegap vs. Titanium. Smasshingmagazine hat auch einen Artikel dazu vom März 2014. U.a. hat Titanium Appcelerator das „look and feel“ einer nativen App. Infoworld vergleicht 5 App-Entwicklungs-Umgebungen (sog. MBaas: AnyPresence, Appcelerator, FeedHenry, Kinvey, und Parse). Cordovablogs hat auch einen Beitrag, in dem auch Xamarin erwähnt ist. Die Diskussion geht dann bei Stackoverflow weiter.

Das Thema Websockets kommt dann wieder auf, und auch, dass es das bei Plan9 nicht gibt.

Auf App-Entwicklung gibt es noch einen spezifischen Beitrag zu den Hürden in PhoneGap.

Xamarin ist gemäß Heiseartikel sperrig und teuer.

Angelo ist von seinem Gras genervt und sein Rasterisierer funktioniert auch nicht richtig.

Nächsten Freitag findet statt.

 

 

13. Februar 2015

13.2.2015

Heute sind Morten und Angelo da, immerhin. Wir reden über die Evangelien, Thomas, Judas und das 1. Konzil in Nicaea.

Wir besprechen noch diese Codezeile bzw. die Zeile in der Funktion:

void
drawPixel(int x, int y, Color c)
{
    *( (Uint32*) ( (char*) screen->pixels + x*screen->format->BytesPerPixel + y*screen->pitch ) ) = SDL_MapRGB(screen->format, c.r, c.g, c.b);
}

In der Funktion müsste man eigentlich noch x testen, dass es nicht größer als die maximale Breite ist. Zu deutsch also:

an die Adresse [*] schreibe vier Bytes (gecastet nach (Uint32*)) eines Pointers auf einen Character (char*), nämlich den Pointer screen->pixels plus x Mal die Länge eines Pixels in Bytes plus y Mal die Zeilenlänge. Ob das so stimmt?

Wir rätseln, wann die anderen mal wieder kommen …;

 

 

 

11. Februar 2015

11.2.2015

Filed under: Allgemein,go,Schulnetzwerk,SDL,Tagesberichte,Tisch,Websockets — admin @ 15:44

Angelo ist da. Morten noch nicht.

Nach Ausschalten des Proxys konnte ich ein Git-Repository SDL-Clone von neaginx klonen.

Angelo schafft was mit Go und SDL. Go jetzt auf dem Lernserver aktualisert. Und dann noch in „./go/src ./allbash“. Angelo fehlen aber noch die Pointer.

Am Freitag sind wir dann vermutlich wieder mehr, denn das Semester hört auch langsam auf.

23. Januar 2015

23.1.2015

Morten, Johannes und Angelo sind da. Der Code wird perfektioniert:

 

#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <SDL/SDL.h>

typedef struct _Color Color;
struct _Color 
{
    unsigned char r, g, b;
};

typedef struct _Point Point;
struct _Point
{
    int x, y;
};

SDL_Surface *screen;

void
drawPixel(int x, int y, Color c)
{
    *((Uint32*)((char*)screen->pixels + x*screen->format->BytesPerPixel + y*screen->pitch)) = SDL_MapRGB(screen->format, c.r, c.g, c.b);
}

void
drawLine(Point p1, Point p2, Color c)
{
    int dx, dy;
    int incx, incy;
    float m;
    dx = p2.x - p1.x;
    dy = p2.y - p1.y;
    incx = dx>0 ? 1 : -1;
    incy = dy>0 ? 1 : -1;
    if(dx == 0){
        int y;
        for(y = p1.y; y != p2.y; y += incy)
            drawPixel(p1.x, y, c);
        return;
    }

    if(abs(dx)>abs(dy)){
        int x;
        float y;
        m = (float)dy/(float)abs(dx);
        y = p1.y;
        for(x = p1.x; x != p2.x; x += incx){
            drawPixel(x, y+0.5f, c);
            y += m;
        }
    }else{
        int y;
        float x;
        m = (float)dx/(float)abs(dy);
        x = p1.x;
        for(y = p1.y; y != p2.y; y += incy){
            drawPixel(x+0.5f, y, c);
            x += m;
        }
    }
}

void
drawTriWire(Point p1, Point p2, Point p3, Color c)
{
    drawLine(p1, p2, c);
    drawLine(p2, p3, c);
    drawLine(p3, p1, c);
}

void
drawHorizontalLine(int y, float x1f, float x2f, Color c) {
    int x1, x2, tmp;
    x1 = (x1f == (int)x1f) ? x1f : x1f+1;
    x2 = (x2f == (int)x2f) ? x2f : x2f+1;
    if(x1 > x2){
        tmp = x1;
        x1 = x2;
        x2 = tmp;
    }
    while(x1 < x2)
        drawPixel(x1++, y, c);
}

void
//~ sortPoints(Point **p) ident mit zeile drunter, for educational purpose only 
sortPoints(Point *p[])
{
#define SWAPPOINT(p,q) { \
        tmp = p;      \
        p = q;     \
        q = tmp;      \
    }
    Point *tmp;
    if(p[0]->y > p[1]->y) 
        SWAPPOINT(p[0], p[1]);
    if(p[0]->y > p[2]->y)
        SWAPPOINT(p[0], p[2]);
    if(p[1]->y > p[2]->y) 
        SWAPPOINT(p[1], p[2]);
#undef SWAPPOINT
}

void
drawTriFlat(Point p1, Point p2, Point p3, Color c)
{
    float dx[3];
    int y;
    float x1, x2;
    Point *p[] = {&p1, &p2, &p3};
    sortPoints(p);
#define D(p,q) (q->y - p->y == 0 ? 0.0f : (float) (q->x - p->x) / (q->y - p->y))
    //~ dx[0] = (float) (p[2]->x - p[0]->x) / (p[2]->y - p[0]->y);
    dx[0] = D(p[0], p[2]);
    dx[1] = D(p[0], p[1]);
    dx[2] = D(p[1], p[2]);
#undef D
    y = p[0]->y;
    x1 = x2 = p[0]->x;
    while(y < p[1]->y){
        drawHorizontalLine(y, x1, x2, c);
        y++;
        x1 += dx[0];
        x2 += dx[1];
    }
    x2 = p[1]->x;
    while(y < p[2]->y){
        drawHorizontalLine(y, x1, x2, c);
        y++;
        x1 += dx[0];
        x2 += dx[2];
    }
}



void
drawRect(Point p1, Point p2, Color rgb)
{
    int i, j;
       for(i = p1.x; i < p2.x; i++)
        for(j = p1.y; j < p2.y; j++)
            drawPixel(i, j, rgb);
}

void
draw(void)
{
    drawRect((Point){40,140}, (Point){50,150}, (Color) {255, 0, 255});
    drawRect((Point){80,140}, (Point){90,150}, (Color) {255, 0, 255});
    drawRect((Point){62,160}, (Point){68,180}, (Color) {10, 123, 233});
    drawRect((Point){40,195}, (Point){90,200}, (Color) {123, 233, 10});
    
//    drawLine((Point){0, 0}, (Point){50, 30});
//    drawLine((Point){0, 0}, (Point){30, 50});
//    drawLine((Point){50, 0}, (Point){50, 50});
        drawTriFlat((Point){30,120}, (Point){100, 120}, (Point){65, 100}, (Color){25, 85, 155});
}

int
main(void)
{
    int running = 1;
    int w = 640;
    int h = 480;
    SDL_Event event;

    SDL_Init(SDL_INIT_VIDEO);

    screen = SDL_SetVideoMode(w, h, 32, SDL_HWSURFACE);

    while(running){
        while(SDL_PollEvent(&event))
            if(event.type == SDL_QUIT)
                running = 0;
        SDL_LockSurface(screen);
        draw();
        SDL_UnlockSurface(screen);
        SDL_UpdateRect(screen, 0, 0, 0, 0);
    }

    SDL_Quit();
    return 0;
}

bringt:

 

test3

 

Angelo will keine Kreise machen.

#include 
#include 
#include 
#include <SDL/SDL.h>
#include 
typedef struct _Color Color;
struct _Color 
{
    unsigned char r, g, b;
};

typedef struct _Point Point;
struct _Point
{
    int x, y;
};

SDL_Surface *screen;

void
drawPixel(int x, int y, Color c)
{
    *((Uint32*)((char*)screen->pixels + x*screen->format->BytesPerPixel + y*screen->pitch)) = SDL_MapRGB(screen->format, c.r, c.g, c.b);
}

void
drawLine(Point p1, Point p2, Color c)
{
    int dx, dy;
    int incx, incy;
    float m;
    dx = p2.x - p1.x;
    dy = p2.y - p1.y;
    incx = dx>0 ? 1 : -1;
    incy = dy>0 ? 1 : -1;
    if(dx == 0){
        int y;
        for(y = p1.y; y != p2.y; y += incy)
            drawPixel(p1.x, y, c);
        return;
    }

    if(abs(dx)>abs(dy)){
        int x;
        float y;
        m = (float)dy/(float)abs(dx);
        y = p1.y;
        for(x = p1.x; x != p2.x; x += incx){
            drawPixel(x, y+0.5f, c);
            y += m;
        }
    }else{
        int y;
        float x;
        m = (float)dx/(float)abs(dy);
        x = p1.x;
        for(y = p1.y; y != p2.y; y += incy){
            drawPixel(x+0.5f, y, c);
            x += m;
        }
    }
}

void
drawTriWire(Point p1, Point p2, Point p3, Color c)
{
    drawLine(p1, p2, c);
    drawLine(p2, p3, c);
    drawLine(p3, p1, c);
}

void
drawHorizontalLine(int y, float x1f, float x2f, Color c) {
    int x1, x2, tmp;
    x1 = (x1f == (int)x1f) ? x1f : x1f+1;
    x2 = (x2f == (int)x2f) ? x2f : x2f+1;
    if(x1 > x2){
        tmp = x1;
        x1 = x2;
        x2 = tmp;
    }
    while(x1 < x2)         drawPixel(x1++, y, c); } void //~ sortPoints(Point **p) ident mit zeile drunter, for educational purpose only  sortPoints(Point *p[]) { #define SWAPPOINT(p,q) { \         tmp = p;      \         p = q;     \         q = tmp;      \     }     Point *tmp;     if(p[0]->y > p[1]->y) 
        SWAPPOINT(p[0], p[1]);
    if(p[0]->y > p[2]->y)
        SWAPPOINT(p[0], p[2]);
    if(p[1]->y > p[2]->y) 
        SWAPPOINT(p[1], p[2]);
#undef SWAPPOINT
}

void
drawTriFlat(Point p1, Point p2, Point p3, Color c)
{
    float dx[3];
    int y;
    float x1, x2;
    Point *p[] = {&p1, &p2, &p3};
    sortPoints(p);
#define D(p,q) (q->y - p->y == 0 ? 0.0f : (float) (q->x - p->x) / (q->y - p->y))
    //~ dx[0] = (float) (p[2]->x - p[0]->x) / (p[2]->y - p[0]->y);
    dx[0] = D(p[0], p[2]);
    dx[1] = D(p[0], p[1]);
    dx[2] = D(p[1], p[2]);
#undef D
    y = p[0]->y;
    x1 = x2 = p[0]->x;
    while(y < p[1]->y){
        drawHorizontalLine(y, x1, x2, c);
        y++;
        x1 += dx[0];
        x2 += dx[1];
    }
    x2 = p[1]->x;
    while(y < p[2]->y){
        drawHorizontalLine(y, x1, x2, c);
        y++;
        x1 += dx[0];
        x2 += dx[2];
    }
}



void
drawRect(Point p1, Point p2, Color rgb)
{
    int i, j;
   	for(i = p1.x; i < p2.x; i++)
		for(j = p1.y; j < p2.y; j++)
			drawPixel(i, j, rgb);
}

void 
drawCircle(Point center, int radius, Color c) {
    Point p;
    int x;
    int y;
    for(x = 0; x < radius; x++){
        y = sqrt(radius*radius - x*x);
        drawLine((Point) {center.x + x, center.y + y}, (Point) {center.x + x, center.y - y}, c); 
        drawLine((Point) {center.x - x, center.y + y}, (Point) {center.x - x, center.y - y}, c); 
    }

}

void
draw(void)
{
    drawCircle((Point){65, 170}, 45, (Color) {128, 128, 0});
    drawRect((Point){40,140}, (Point){50,150}, (Color) {255, 0, 255});
    drawRect((Point){80,140}, (Point){90,150}, (Color) {255, 0, 255});
    drawRect((Point){62,160}, (Point){68,180}, (Color) {10, 123, 233});
    drawRect((Point){40,195}, (Point){90,200}, (Color) {123, 233, 10});
    
//    drawLine((Point){0, 0}, (Point){50, 30});
//    drawLine((Point){0, 0}, (Point){30, 50});
//    drawLine((Point){50, 0}, (Point){50, 50});
        drawTriFlat((Point){30,120}, (Point){100, 120}, (Point){65, 100}, (Color){25, 85, 155});
}

int
main(void)
{
	int running = 1;
	int w = 640;
	int h = 480;
	SDL_Event event;

	SDL_Init(SDL_INIT_VIDEO);

	screen = SDL_SetVideoMode(w, h, 32, SDL_HWSURFACE);

	while(running){
		while(SDL_PollEvent(&event))
			if(event.type == SDL_QUIT)
				running = 0;
		SDL_LockSurface(screen);
		draw();
		SDL_UnlockSurface(screen);
		SDL_UpdateRect(screen, 0, 0, 0, 0);
	}

	SDL_Quit();
	return 0;
}

chinese

Nächste Woche ist nicht.

 

Angelo orientiert sich nach dem GS UsersManual für die PS2.

21. Januar 2015

21.1.2015

Morten ist da. Wir reden über Windows ultimate. Und Ableton.

Jetzt sieht der Code so aus:

#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <SDL/SDL.h>

typedef struct _Color Color;
struct _Color 
{
    unsigned char r, g, b;
};

typedef struct _Point Point;
struct _Point
{
    int x, y;
};

SDL_Surface *screen;

void
drawPixel(int x, int y, Color c)
{
    *((Uint32*)((char*)screen->pixels + x*screen->format->BytesPerPixel + y*screen->pitch)) = SDL_MapRGB(screen->format, c.r, c.g, c.b);
}

void
drawLine(Point p1, Point p2, Color c)
{
    int dx, dy;
    int incx, incy;
    float m;
    dx = p2.x - p1.x;
    dy = p2.y - p1.y;
    incx = dx>0 ? 1 : -1;
    incy = dy>0 ? 1 : -1;
    if(dx == 0){
        int y;
        for(y = p1.y; y != p2.y; y += incy)
            drawPixel(p1.x, y, c);
        return;
    }

    if(abs(dx)>abs(dy)){
        int x;
        float y;
        m = (float)dy/(float)abs(dx);
        y = p1.y;
        for(x = p1.x; x != p2.x; x += incx){
            drawPixel(x, y+0.5f, c);
            y += m;
        }
    }else{
        int y;
        float x;
        m = (float)dx/(float)abs(dy);
        x = p1.x;
        for(y = p1.y; y != p2.y; y += incy){
            drawPixel(x+0.5f, y, c);
            x += m;
        }
    }
}

void
drawTriWire(Point p1, Point p2, Point p3, Color c)
{
    drawLine(p1, p2, c);
    drawLine(p2, p3, c);
    drawLine(p3, p1, c);
}

void
drawRect(Point p1, Point p2, Color rgb)
{
    int i, j;
       for(i = p1.x; i < p2.x; i++)
        for(j = p1.y; j < p2.y; j++)
            drawPixel(i, j, rgb);
}

void
draw(void)
{
    drawRect((Point){40,40}, (Point){50,50}, (Color) {255, 0, 255});
    drawRect((Point){80,40}, (Point){90,50}, (Color) {255, 0, 255});
    drawRect((Point){62,60}, (Point){68,80}, (Color) {10, 123, 233});
    drawRect((Point){40,95}, (Point){90,100}, (Color) {123, 233, 10});
    
//    drawLine((Point){0, 0}, (Point){50, 30});
//    drawLine((Point){0, 0}, (Point){30, 50});
//    drawLine((Point){50, 0}, (Point){50, 50});
        drawTriWire((Point){10,10}, (Point){100, 70}, (Point){30, 150}, (Color){255, 255, 255});
}

int
main(void)
{
    int running = 1;
    int w = 640;
    int h = 480;
    SDL_Event event;

    SDL_Init(SDL_INIT_VIDEO);

    screen = SDL_SetVideoMode(w, h, 32, SDL_HWSURFACE);

    while(running){
        while(SDL_PollEvent(&event))
            if(event.type == SDL_QUIT)
                running = 0;
        SDL_LockSurface(screen);
        draw();
        SDL_UnlockSurface(screen);
        SDL_UpdateRect(screen, 0, 0, 0, 0);
    }

    SDL_Quit();
    return 0;
}

 

Und das Resutlat so:

 

 

c2

Nächste Mal dann Ausfüllen von Dreiecken, 3D-Rotation und Kreise …;

Morten bastelt daran rum, wie ein Spiel unter Windows startet …;

Diesen Freitag ist noch einmal, dann zwei Wochen Pause.

 

14. Januar 2015

14.1.2015

Heute ist Tag der offenen Tür. Deshalb vermutlich nicht ganz so lange. Morten hat Probleme mit Pidgin und MSN. Wir reden über Abmahnung. S.a. Infos zu Waldorf Frommer. Angelo nutzt übrigens nicht Pidgin sondern BitlBee. Das übersetzt auf IRC. Angelo arbeitet dann mit Tmux. Damit kann man Terminalsessions teilen und splitten. Angelo nutzt QEmu um Windows laufen zu lassen. Das kann emulieren und virtualisieren (aber auf FreeBSD kann es nur emulieren, das Kernelmodul für Virutalisierung gibt es da noch nicht). Wir sprechen über die Ausnahmlosigkeit der Lautgesetze (Junggrammatiker Ende des 19. Jahrhunderts). Kurz schrammen wir noch am rheinischen Fächer vorbei.

9. Januar 2015

9.1.2015

Filed under: Allgemein,Computer,Lernserver,Schulnetzwerk,Termine,Tisch — admin @ 15:42

Es stürmt. Frau Spyra kam und wir sprachen über die Installation von Android Studio. Überlegung war, eine Portable Version zu benutzen. Außerdem haben wir herausgefunden, was eine Denic-Mitgliedschaft kostet. Nächste und übernächste Woche findet die AG noch statt, die Woche vor den Winterferien, am 28. und 30. Januar, nicht. Moritz programmiert einen Downloadmanager für xdcc in C bzw. in C++. Johannes versucht eine virtuelle Maschine von Windows-XP zu installieren. Robert versucht seine FritzBox von außerhalb zu konfigurieren.

7. Januar 2015

7.1.2015

Morten und Angelo sind da. Frau Kannenberg kam auch, wir haben über Photoshop und grafische Tools gesprochen. Da findet sich bei Photoshop ein Online-Tool. Angelo kann von der PS2 Gebäude auslesen und mit seinem selbst programmierten Grafiktool darstellen lassen. Canvas-Tests liegen im Homefolder von rob bei public_html (s.a. hier). Mortens Arbeiten bezgüglich Datenbank hatten wir hoffentlich schon verlinkt. Roberts Test hoffentlich auch. Morten und Angelo zocken bissel GTA. Am Freitag findet AG statt, normal.

19. Dezember 2014

19.12.2014

Filed under: Computer,Javascript,Lernserver,Tagesberichte,Tisch — admin @ 17:01

Der Weihnachtsmann läuft mit AJAX. Morten, Angelo, Johannes und Moritz sind da. Wir schaffen es ein bisschen, den Weihnachtsmann auf und ab fahren zu lassen. Einen Neigungswinkel mit Canvas schaffen wir nicht mehr. Nächste Mal im neuen Jahr!!!

« Newer PostsOlder Posts »