3083 (toodoo intro <1)

#comment
#freeze

#!/bin/bash
#base href = https://www.serverproject.de
#this is toodoo intro version < 1
#it is evaluation, examination, experiment and exercise
#the code is commented in english
#fragile || predictable
#temp

#retrieve name
var0=`basename "$0"`;
#output name
echo $var0;
#blob
URL=https://github.com/ewingson/edx-02-intro/blob/master/intro

#retrieve arguments to var1 to var5
var1=$1;
var2=$2;
var3=$3;
var4=$4;
var5=$5;

#COUNTER (not yet used)
#count[1]=$var1;
#count[2]=$var2;
#count[3]=$var3;
#count[4]=$var4;
#count[5]=$var5;

#alternative extreme array conscience programming (rule conform)
self[0]=$var1
self[1]=$var2
self[2]=$var3
self[3]=$var4
self[4]=$var5

#output and count arguments
j=0
for i in ${self[@]}; do
echo $i
j+=1
done
slength="$j"
size=${#slength}
#echo $COUNTER

#toodoo
#we must check if arguments are set

#boole b1 must be set if argument $1 exists (!-ne)
if [ -n $var1 ]
  then
        b1=false
else
	b1=true 
fi
#boole b2
if [ -n $var2 ]
  then
        b2=false
else
	b2=true 
fi
#boole b3
if [ -n $var3 ]
  then
        b3=false
else
	b3=true 
fi
#boole b4
if [ -n $var4 ]
  then
        b4=false
else
	b4=true 
fi
#boole b5
if [ -n $var5 ]
  then
        b5=false
else
	b5=true 
fi
#now we have all we need

#check the five boolean
if [[ $b1=true || $b2=true || $b3=true || $b4=true || $b5=true ]];
then flag=1
else flag=0
fi
    if [ $flag=1 ]
    then
#whether exists or not output status and argument 
            if [ $b1=true ]
            then
            echo argument ${var1} exists
#other case
            else
            echo argument ${var1} does not exist
            fi
            if [ $b2=true ]
            then
            echo argument ${var2} exists
            else
            echo argument ${var2} does not exist
            fi
		    if [ $b3=true ]
            then
            echo argument ${var3} exists
            else
            echo argument ${var3} does not exist
            fi
            if [ $b4=true ]
            then
            echo argument ${var4} exists
            else
            echo argument ${var4} does not exist
            fi
            if [ $b5=true ]
            then
            echo argument ${var5} exists
            else
            echo argument ${var5} does not exist
            fi
    else
#error message and exit if invalid number of arguments
    echo "Arguments are zero or > 5"
#exit 1
    exit 1
    fi
#array syntax is variable[index]=$value
arrlength=$size-1;
echo $size;

#toodoo
#we want printf(%d total %d arguments, $size, $arrlength);

#toodoo
#direction = (0 || 1 || 2038 || x203x || 4 || (5 && true))

#SI-Einheiten

#SI seconds for light to sun
sun=8*60
#SI seconds for lifetime sun
runtime=5000000000*365*24*60*60
#SI speed of light in meter/second
lightspeed=299792458
#SI distance light makes in a year in meter/year
lightyear=9460730472580800
#alphabet
alphabet="abcdefghijklmnopqrstuvwxyz"

#if (variable0=true)
#{
#ping 2a01:488:42:1000:50ed:854a:cc:d5a8
#}

#exit 0
exit 0

https://github.com/ewingson/edx-02-intro

3080 (ex*)

experiment or exercise ?

<a href = 'https://github.com/'>https://github.com/</a> | <a href = 'https://guides.github.com/activities/hello-world/'>https://guides.github.com/activities/hello-world/</a><br />

<a href = 'https://www.geeksforgeeks.org/'>https://www.geeksforgeeks.org/</a> | <a href = 'https://ide.geeksforgeeks.org/index.php'>https://ide.geeksforgeeks.org/index.php</a><br />

3078 (SELECT * FROM *)

k.i. theoretisch

item word
https://www.google.com ball
https://www.google.nl pons
https://www.google.es quicksort
https://www.google.to speed
https://www.google.com.tw meditation
https://www.google.com.hk vengeance
https://www.google.mg unity
https://www.google.de useless stuff

k.i. praktisch

item association
http://www.datakind.org/ relax
https://dssg-berlin.org/ link
https://ai4good.org/ global
https://www.unglobalpulse.org/ local
http://www.globalforestwatch.org/ forest
https://gamaya.com/ peace
https://www.foodtracks.de/en/ share
https://sourceforge.net/speedtest/ topic
https://sourceforge.net/projects/kibirth/ game
https://cambridgeanalytica.org/ collect

source: https://perspective-daily.de/article/442/sJ1IaeFE

3060 (lab03)

hong kong university edx comp102x lab3 solution

import comp102x.ColorImage;
import comp102x.Canvas;

public class Lab03
{  
    
    public void loadAnImage() 
    {
        // Please write your code after this line
        ColorImage labimg1 = new ColorImage();        
        int w, h;
        w = labimg1.getWidth();
        h = labimg1.getHeight();
        Canvas canvas = new Canvas (w, h);
        canvas.add(labimg1);
        
    }
    
    public void loadTwoImagesOnTheSameCanvas()
    {
        // Please write your code after this line
        int w1, w2, h1, h2;
        ColorImage labimg2 = new ColorImage();
        ColorImage labimg3 = new ColorImage();
        w1 = labimg2.getWidth();
        h1 = labimg2.getHeight();
        w2 = labimg3.getWidth();
        h2 = labimg3.getHeight();
        Canvas canvas2 = new Canvas ((2 * w1), h1);
        canvas2.add(labimg2, 0, 0);
        canvas2.add(labimg3, w1, 0);
        
    }
    
    public void imageAddition() 
    {    
        // Please write your code after this line
        int ww1, ww2, hh1, hh2;
        ColorImage labimg4 = new ColorImage();
        ColorImage labimg5 = new ColorImage();
        ColorImage labimg6 = labimg4.add(labimg5);
        ww1 = labimg4.getWidth();
        hh1 = labimg4.getHeight();
        ww2 = labimg5.getWidth();
        hh2 = labimg5.getHeight();
        Canvas canvas3 = new Canvas (((3 * ww1) + 20), hh1);
        canvas3.add(labimg4, 0, 0);
        canvas3.add(labimg5, (ww1 + 10), 0);
        canvas3.add(labimg6, ((ww1 * 2) + 20), 0);
        
        
    }
   
    public void imageMultiplication() 
    {
        // Please write your code after this line
        int width1, width2, height1, height2;
        ColorImage labimg7 = new ColorImage();
        ColorImage labimg8 = new ColorImage();
        ColorImage labimg9 = labimg7.multiply(labimg8);
        width1 = labimg7.getWidth();
        height1 = labimg7.getHeight();
        width2 = labimg8.getWidth();
        height2 = labimg8.getHeight();
        Canvas canvas4 = new Canvas (((3 * width1) + 20), height1);
        canvas4.add(labimg7, 0, 0);
        canvas4.add(labimg8, (width1 + 10), 0);
        canvas4.add(labimg9, ((width1 * 2) + 20), 0);
        
        
        
    }
    
    public void changeColor()
    {
        ColorImage image = new ColorImage();
        image.increaseRed(40);
        Canvas canvas = new Canvas(image.getWidth(), image.getHeight());
        canvas.add(image);
        
        image.save();
    }
}

3058 (Car1.java/edx.org-week3-java-intro)

Car1.java – sample object from week3 java comp102x @ edx.org

import comp102x.Canvas;
import comp102x.ColorImage;
import java.io.PrintStream;







public class Car1
{
  String owner = "NoName";
  ColorImage carImage = new ColorImage("c5.png");
  ColorImage wImage = new ColorImage(800, 600);
  int odometer = 0;
  
  public Car1() {
    Canvas canvas = new Canvas();
    canvas.add(wImage);
    canvas.add(carImage, 200, 200);
  }
  
  public Car1(String nameOfOwner)
  {
    owner = nameOfOwner;
    carImage = new ColorImage();
    Canvas canvas = new Canvas();
    canvas.add(wImage);
    canvas.add(carImage, 200, 200);
  }
  
  public void move(int dist)
  {
    double radian = Math.toRadians(carImage.getRotation());
    double distX = dist * Math.cos(radian);
    double distY = dist * Math.sin(radian);
    odometer += dist;
    
    carImage.setX(carImage.getX() + (int)distX);
    carImage.setY(carImage.getY() + (int)distY);
  }
  
  public void moveCar(int dist) {
    int unit = 10;
    int steps = Math.abs(dist / unit);
    if (dist < 0) unit = -unit;
    for (int i = 0; i < steps; i++) {
      move(unit);
      pause(20);
    }
  }
  
  public void turnCar(int rotateAngle) {
    double rAngleRadian = Math.toRadians(1.0D);
    double radius = carImage.getWidth() * 2.0D;
    while (rotateAngle > 0) {
      carImage.setRotation((int)(carImage.getRotation() + 1.0D) % 360);
      double moveDist = Math.abs(2.0D * radius * Math.sin(rAngleRadian / 2.0D));
      move((int)moveDist);
      rotateAngle--;
      
      pause(10);
    }
  }
  
  public static void pause(int sleepTime)
  {
    try {
      Thread.sleep(sleepTime);
    } catch (InterruptedException e) {
      System.err.println("Error in running rotation animation!");
      System.exit(-1);
    }
  }
}