# Code a Week

So this week completes somewhat my dive into processing, at least for a a little while. We salvaged working copies of Canon X-07, which understands the programming language of my childhood: BASIC! WUHUU!!!

Canon X-07

So I am going to be experimenting with that and sharing some results. I am also teaching two eTextile courses in the coming months and using Adafruits Gemma’s and Flora’s in then so some ATTiny code is following also.
But here is Wittgenstein and vectors with force applied into them. The grey dot should be draggable, not sure if it works in the p5.js environment though.
[p5js code canvas]class Attractor {
float mass;
float G;
PVector location;
boolean dragging = false;
boolean rollover = false;
PVector dragOffset;
Attractor() {
location = new PVector(width/2,height/2);
mass = 20;
G = (second()/30);
dragOffset = new PVector(0.0,0.0);
}

PVector attract(Mover m) {
PVector force = PVector.sub(location,m.location);
float d = force.mag();
d = constrain(d,5.0,25.0);
force.normalize();
float strength = (G * mass * m.mass) / (d * d);
force.mult(strength);
return force;
}

void display() {
ellipseMode(CENTER);
noStroke();
if (dragging) fill (second()*4.25,50);
if (dragging) text(“Knowledge is in the end based on acknowledgement.”,350,mouseY+6);
else if (rollover) fill(240,40,40,200);
else fill(175,200);
ellipse(location.x,location.y,mass*2,mass*2);
}

void clicked(int mx, int my) {
float d = dist(mx,my,location.x,location.y);
if (d < mass) {
dragging = true;

dragOffset.x = location.x-mx;
dragOffset.y = location.y-my;

}
}

void hover(int mx, int my) {
float d = dist(mx,my,location.x,location.y);
if (d < mass) {
rollover = true;
text(“One often makes a remark and only later sees how true it is.”,mouseX-80,mouseY+50);

}
else {
rollover = false;
fill(255);
text(“One often makes a remark and only later sees how true it is.”,100,240);
}
}

void stopDragging() {
dragging = false;
fill(255);
text(“Knowledge is in the end based on acknowledgement.”,150,150);
}

void drag() {
if (dragging) {
location.x = mouseX + dragOffset.x;
location.y = mouseY + dragOffset.y;
}
}

}

class Mover {

PVector location;
PVector velocity;
PVector acceleration;
float mass;

Mover(float m, float x, float y) {
mass = m;
location = new PVector(x, y);
velocity = new PVector(1, 0);
acceleration = new PVector(0, 0);
}

void applyForce(PVector force) {
PVector f = PVector.div(force, mass);
}

void update() {
acceleration.mult(0);
}

void display() {
noStroke();
fill(10,180,140,100);
ellipse(location.x, location.y, mass*25, mass*25);
}
}

Mover[] movers = new Mover[10];

Attractor a;

void setup() {
PFont myFont;
myFont = createFont(“Georgia”, 12);
textFont(myFont);
size(640, 360);
for (int i = 0; i < movers.length; i++) {
movers[i] = new Mover(random(0.1, 2), random(width), random(height));
}
a = new Attractor();
}

void draw() {
background(255);

a.display();
a.drag();
a.hover(mouseX, mouseY);

for (int i = 0; i < movers.length; i++) {
PVector force = a.attract(movers[i]);
movers[i].applyForce(force);

movers[i].update();
movers[i].display();
}
}

void mousePressed() {
a.clicked(mouseX, mouseY);
}

void mouseReleased() {
a.stopDragging();
}

[/p5js]

Again did not have very much time to code and after coding mostly in C for arduino etc. I do find Java & Javascript (the p5.js) to not really fit into my way of thinking. I do still enjoy it and this week I mostly ported the first week’s scipt into vectors. Inspired again (a lot) by Shiffmans Nature of Code-book. It is a recommendable book, if you have some background on programming and Object-oriented programming. Not the most clearly written, but fun. He has done a video tutorials also, which are a joy to watch.

Anyway this weeks code might not work on mobile devices that well, as it does track your mouse position. But who knows if it miraculously detects your touch also… (Did not code that into it, altough p5.js has support for touch controls.) And it’s a one minute loop on the text part. So stick around for the finale..

Wittgenstein and certainty:
[p5js code canvas]void thought1(){
int m = second();
if (m >5 && m <25 ){ fill(0); text("I act with complete certainty. But this certainty is my own.",100,250); } else { fill(255); text("I act with complete certainty. But this certainty is my own.",100,250); } } void thought2(){ int m = second(); if (m >27 && m <55 ){ fill(0); text("At the core of all well-founded belief lies belief that is unfounded.",100,50); } else { fill(255); text("At the core of all well-founded belief lies belief that is unfounded.",100,50); } } class Mover { PVector location; PVector velocity; PVector acceleration; float topspeed; Mover() { location = new PVector(width/2, height/2); velocity = new PVector(0, 0); topspeed = 10; } void update() { acceleration = PVector.random2D(); acceleration.mult(random(2)); velocity.add(acceleration); velocity.limit(topspeed-int(random(10))); location.add(velocity); } void display() { fill(255,50); noStroke(); rect(0,0,640,360); fill(10); ellipse(location.x, location.y, 5, 5); } void checkEdges() { if (location.x > width) {
location.x = 0;
}
else if (location.x < 0) { location.x = width; } if (location.y > height) {
location.y = 0;
}
else if (location.y < 0) { location.y = height; } } } class Follower { PVector location2; PVector velocity2; PVector acceleration2; float topspeed2; Follower() { location2 = new PVector(random(width),random(height)); velocity2 = new PVector(0,0); topspeed2 = 4; } void update2() { PVector mouse = new PVector(mouseX,mouseY); PVector dir = PVector.sub(mouse,location2); dir.normalize(); dir.mult(0.5); acceleration2 = dir; velocity2.add(acceleration2); velocity2.limit(topspeed2); location2.add(velocity2); } void display2() { noStroke(); fill(255,0,0,100); ellipse(location2.x,location2.y,4,4); } void checkEdges2() { if (location2.x > width) {
location2.x = 0;
} else if (location2.x < 0) { location2.x = width; } if (location2.y > height) {
location2.y = 0;
} else if (location2.y < 0) { location2.y = height; } } } Mover mover; Follower[] follower = new Follower[20]; void setup() { PFont myFont; myFont = createFont("Georgia", 12); textFont(myFont); size(640,360); mover = new Mover(); for (int i = 0; i < follower.length; i++) { follower[i] = new Follower(); } background(255); } void draw() { thought1(); thought2(); mover.update(); mover.checkEdges(); mover.display(); for (int i = 0; i < follower.length; i++) { follower[i].update2(); follower[i].checkEdges2(); follower[i].display2(); } }[/p5js]

This week I really didn’t have a lot of time. So I played around with Perlin noise. And Shiffman’s Nature of code book.

I have been researching creative coding as a practice in art education for a year now and thinking about much longer. Starting a new year, I realized I have not coded that much during the last year. So I set myself a little challenge -To write a little nifty program every week. – To get myself familiar with the most basic stuff again. These are nothing miraculous or fancy. But something fun for myself. Besides the code, I am exploring the artistic qualities of the code in these little sketches.

Last week I took part in Creative Citizens conference at Royal College of Arts in London. It was two days filled with interesting talks and presentation all based on creative citizenship. Creative Citizens is a research project and has three main themes: hyperlocal publishing, community-led design and creative networks. I think all of the different themes were nicely portrayed, and talks gave a nice variety on different topics. These sort of projects that fuse together different fields from politics, education to art is something I would like to see happen in Finland also.
Nevertheless, after the conference I started to think (Well I am a Finn after all…) about digital citizenship portrayed through social media platforms and some particular question came to mind:  How much is using social media as an active, critical, citizen just playing with the tools that we are given to play with? Are we just playing in the sandbox of largely censored, monitored products, which turn our messages into money? How much more effective could our criticality be, if we had to say over the platforms? Or even: If we could be part of building them?
Jean Burgess, professor at the Queensland University of Technology, gave a very good talk on creative citizenship and social media. She gave the example of silly citizenship (a great name and concept!) as one example to engage critically in social media platforms. Silly citizenship uses social medias own tools to work as a humorous way to engage in politics. One meme she mentioned as an example was a photo of British prime minister David Cameron calling to Barack Obama to have a talk about the situation in Ukraine. The photo was shared through twitter and was quite comical. Internet quickly followed with it own versions of it and so a meme was born. According to Burgess this kind of ”Silly Citizenship” can be  one way to engage with the world around us: even though the message is funny and entertaining it still carries a political message.

I do think that this kind of activity is good and to be encouraged. Still, I do ponder on the platform itself*: This kind of activity seems very little one can do. Naturally there are ways to engage more but why are they so difficult? How Is the situation between new media corporations sitting in US and us different to western missionaries going to Africa in the olden days? Bringing with them shiny new things as an exchange for something much more valuable? – Thing is that most of the platforms we use (in western countries) are made by tiny number of US-based young, often white, male engineers. Many platforms still don’t have their revenue plan worked out yet (Twitter anyone?) and hardly any of them have given any thought on the platforms civic engagement, etc. Let alone have any research made on what would be a good platform. And of course why should they? These are startups and corporations looking to make the most money for them and their investors. We are offered free products as an exchange of our information. These products are not designed to be democratic or equal, but entertaining and engaging to use.
How will the future look like for us? In 20 years are we, as citizens, being colonized and depleted by algorithms of social media corporation?
This is one of the reasons I think we need an understanding of the digital world in a deeper level, we in a way need to be code literate in order to be equal in the digital world. We also would much need an open democratically funded social media platform to succeed. Then I think we could use social media much more effectively.

* I don’t mean the remaining pondering as a critique to Burgess’s talk, rather I found it inspiring and gave me good starting point for my own trail of thoughts to emerge.

# FRACTALNOIA

## – 11 datasets you cannot believe just happened.

The collection of data is increasing exponentially and it is more and more available to the general public as private databases are opened up. This Big Data holds promises of new insights, unparalleled innovation, even articifical intelligence. However, the ubiquity and availability of data connected to our human desire to see patterns where none exist means that humans have to deal with increasing amounts of meaningless data analysis, “fact-based” conspiracy theories and click-bait infographics. As the data is all digital, it morphs easily into whatever we want, releases itself from the context and appears on fashionable graphs that may look nice, but carry no meaning.

In our installation, we want to show how arbitrary and easy it is to make “data analysis”, deduce causations from correlations and combine different datasets. In addition, we want to give the audience a physical feeling of the datasets, although it is inherently false, to further point out how the context of the dataset can be chosen. The audience gets to manipulate the data by placing everyday physical objects, such as fruit, to a table. The objects present different datasets and graphs are created based these datasets. We thus combine a primitive action of moving common objects to the digital world of information technology and project the resulting graphs for the audience to see. By being able to literally grasp the data and create any type of combination of the datasets, the audience gets to experience both the ease and complexity of drawing meaning from data.

Tänä syksynä ohjelmoinnin opetus on ollut esillä mediassa useampaan otteeseen. Viimeisimpänä on uuden opetussuunnitelman luonnos, jossa ohjelmoinnin opetusta on nostettu esille. Tästä on noussut keskustelua* siitä mitä se ohjelmointi oikeastaan on ja miksi sitä pitäisi nyt kouluissa opettaa?  Keskustelusta inspiroituneena päätin kirjoittaa vapaamuotoisesti hieman omia ajatuksiani asiasta.

Kysymystä ohjelmoinnin opetuksen tärkeydestä voidaan toki tarkastella usealta eri kannalta. Ehkä nopeiten mieleen tulee työelämän oma kanta ja suomalaisen peliteollisuuden tämänhetkinen noste: koulujen olisi hyvä opettaa ohjelmointia, jotta kykenisimme paremmin vastaamaan työelämän kasvaviin ohjelmoijatarpeisiin. Tämä näkemys on kuitenkin yksipuolinen ja melko kapea. Vaikka peliteollisuus Suomessa kasvaisikin tärkeäksi työllistäjäksi ei se ehkä yksinään riitä perustelemaan uuden oppiaineen syntyä.

Ohjelmointia voidaan perustella sen ominaisuuksilla: se kasvattaa ongelmanratkaisutaitoja, loogista ajattelua, matemaattisia taitoja, taiteellisia taitoja ja jopa onnistuu näiden integroinnissa. Ei mikään pieni asia tämä. Varsinkin kun ohjelmointi yhdistetään fyysiseen maailmaan (esimerkiksi arduinon avulla, kuten vaikka Jouni Korhosen esimerkissä) ja otetaan mukaan peruskoulussa vielä käsityöt ja elektroniikka niin pääsemme ohjelmoimaan robotteja tai omia älyvaatteita. Voi kuulostaa ufoilulle, mutta on itseasiassa aivan mahdollinen ja realistinen projekti toteuttaa peruskoulussa.

Omasta mielestäni silti tämäkään ei ole se tärkein asia miksi ohjelmointia pitäisi opettaa kouluissa. Asiaa kannattaisi katsoa kenties hieman laajemmasta näkökulmasta ja miettiä miten maailma jossa elämme toimii?

– Herätessämme aamulla painamme kahvinkeittimemme napin päälle ja kahvinkeitin keittää meille aamukahvin, television kaukosäätimestä painamalla saamme television päälle, katsomme kenties tabletilta uutiset, sähköpostit, viestit, sään jne… Työmatkalla auto varoittaa että turvavyö ei ole päällä tai jos matkaamme bussilla bussikortti piippaa lukijassa merkiksi veloitetusta matkasta, työpaikan ovet avautuvat kortinlukijalla, kaupankassalla ostokset luetaan viivakoodinlukijalla… -listaa voisi jatkaa loputtomiin. Koko yhteiskuntamme toimii digitaalisen tekniikan varassa. Ja tulevaisuudessa vielä enemmän varsinkin, jos ,ja kun robotiikka alkaa korvaamaan yhä useampia ammatteja, samalla kun yhä useammat palvelut ovat automatisoituja tai toimivat osittain automatisoidusti. Yhteistä kaikelle tälle digitaaliselle tekniikalle on se että ne ovat luonteeltaan ohjelmoituja.  Kuinka nopeasti vesi tippuu kahvinkeittimessä, kuinka ärsyttävä on auton varoitusääni, miten hyvin sähköpostimme toimii jne… Digitaalinen tekniikka on ennalta jonkun päättämää ja määrittämää. Se että sähköpostimme asetusviidakko on käsittämätön, tai VR:n lippujärjestelmä ei toimi oikein ei edusta objektiivista totuutta vaan muutaman koodarin päätöksiä ja oletuksia. Näillä muutaman henkilön tekemillä päätöksillä on kuitenkin valtavia vaikutuksia jokapäiväiseen elämäämme.

Tiedostamalla ohjelmoinnin kaikkiaallisuuden sekä sen ettei ohjelmointi ole arvovapaata tuo esille mielestäni ohjelmoinnin opetuksen tärkeimmän syyn: Digitaalisen tekniikan ohjelmoitu luonne tekee ohjelmointia ymmärtävistä ja ymmärtämättömistä eriarvoisia. Ja mitä enemmän siirrymme digitaaliseen yhteiskuntaan sitä suuremmaksi tuo eriarvoisuus syvenee. Ohjelmoinnin opetuksen tärkein elementti ei mielestäni siis ole se, että opetamme lapsistamme ohjelmoijia peliteollisuuteen, vaan se että opetamme heistä täysivertaisia digitaalisen ajan kansalaisia, jotka pystyvät ymmärtämään mitä heidän ympärillään tapahtuu. Sillä ilman tätä ymmärrystä heidän on vaikea vaatia muutosta tai kritisoida ympäristöä tai yhteiskuntaa.** Ohjelmoinnin opetusta voisi kenties kutsua ohjelmoinnin lukutaidon*** opetukseksi?

Netissä:

http://www.tietoviikko.fi/kaikki_uutiset/ministeri+ohjelmointi+tulee+peruskouluihin/

http://www.edutopia.org/blog/code-literacy-21st-century-requirement-douglas-rushkoff

** Tässä miellän opetuksen tehtäväksi sekä kasvattamaan yhteiskunnan jäseneksi, myös kasvattamaan oppilasta sellaiseksi jäseneksi, joa käystyy muokkamaan yhteiskuntaa ja osallistumaan yhteiskunnan kehitykseen tasavertaisena jäsenenä. Eli käsitykseni on kriittisen pedagogiikan peruja Henry Girouxin mukaan. (Ks. esim. Henry Giroux: On Critical Pedagogy)

*** Ohjelmoinnin lukutaidon englanninkielistä termiä Code literacy käyttää ainakin mediateoreetikko Douglas Rushkoff, jonka hieman kärjistyneet tekstit ovat ihan ok luettavaa aiheeseen. Katso esimerkiksi: Program or be programmed, Ten Commands for a Digital Age. Käytännön esimerkkejä antaa esimerkiksi Libow Martinez & Stagerin kirja: Invent to Learn: Making, Tinkering and Engineering in the Classroom. Koodin vallasta kirjoitti ansioituneesti jo Lawrence Lessig kirjassaan Code and other Laws of Cyberspace. Mielenkiintoinen kirja edelleenkin!

I recently watched Brett Victors talk from SF SIGGRAPh from 2012 where he talks about artists need to learn code, or to be more specific he argues that artists shouldn’t need to learn to code in order to take control of digital media. I found his ideas very insightful (As always, couldn’t recommend more to check out his other stuff too.) but still I tend to disagree with him on this. Below I write some reasons why. To really understand I suggest to watch the presentation before, it is well worth your time, if you are at all interested on what is happening in the digital arts at the moment.

For the last five or so years I have extensively worked with digital media. My art works use digital technologies and I have taught digital technologies. In my day work I use computers for almost everything. I have to say that many things run very smoothly with digital technologies. Pictures, video, programming (naturally) -All this enables me to do-and create-  many things.

But…

I recently read Christopher Steiners: Automate This: How Algorithms Came to Rule Our World (2012) which is a good overview of how computer algorithms have become commonplace in most unusual places.

Steiner starts his journey with the 2010 flash crash in Wall Street, when Dow Jones suddenly lost over trillion dollars of it’s value in one day. Which is by the far the largest single loss ever recorded. Reason for this loss was a bug in one of the automated trading algorithms. Steiner then expands to the history of algorithms and how they took over stock trading and how they are now taking over many other areas, like entertainment industry, medical and health care industry. Steiner’s book is a good introduction on algorithms and their importance in our lives. The book got me thinking about algorithms in culture creation, where they are also already utilized.