Weblog
Genesis
Column Klokgelui voor Overschiese Krant.
U snapt wel waar deze column over gaat: de tentoonstelling Genesis, in het Fotomuseum. Ik had als titel eerst 'blote borsten' gekozen. Die zag ik namelijk op de tentoonstelling, en zo'n titel trekt meer de aandacht, als ik mijn eigen gedachtengang tenminste mag doortrekken naar de gedachten van de gemiddelde lezer van deze krant. Maar om borsten nu ook al als lekkermakertje bij een column namens de kerken te gebruiken, ging me te ver. Niet getreurd: in de inhoud komt u ze zeker tegen.
De fototentoonstelling bestaat uit prachtige zwart-witfoto's uit de natuur. Daarbij zitten ook foto's van mensen die in deze natuur leven. En dat ziet er anders uit dan de meeste familiekiekjes van een gezin uit Overschie. Je ziet blote borsten, beschilderingen, vaak met modder, weelderige pruiken, peniskokers, schotels door lippen of oorlelletjes, pinnen door een neus of zelfs staven door de kin heen. Ze zouden flink opvallen bij een wandeling over de Burgemeester Baumannlaan.
Maar ook zij zouden hun ogen uitkijken als ze ons zagen. Geen beschilderingen met modder, maar wel tattoos. Geen pruiken, hoewel, maar wel hanenkammen. Of gewoon lang, blond haar: ook ik vind dat exotisch. Geen lange peniskokers, wel grote auto's of dure mobieltjes, met wellicht hetzelfde doel. Geen schotels of pinnen door lippen en neuzen, maar wel overal piercings en oorbellen. En blote borsten zie je niet snel op de openbare weg, maar daar hebben we dan weer TV, internet en snapchat voor uitgevonden.
En zo zien wij dit soort volken misschien op het eerste gezicht als primitief, maar eigenlijk zijn ze heel hip en niet zo verschillend van ons.
Ik lees nu een boek, Het recht van de Radch, waarin iedereen wordt aangeduid als 'zij' of 'haar', ook als het over een man gaat. Er staat 'zij gaf haar een hand', en je hebt geen idee of het over twee vrouwen, twee mannen, of een man en een vrouw gaat. Aan kleding of haardracht kan je het ook niet zien, want alle combinaties daarvan vind je bij mannen en vrouwen. Dus waar in de tentoonstelling het verschil tussen man en vrouw duidelijk is, is dat in dit boek totaal anders.
In een ander boek, de bijbel, zegt God: 'Wat je van buiten ziet, is niet belangrijk. Daar kijken mensen altijd het eerst naar, maar ik let erop hoe een mens van binnen is.' Dat is een goede blik om mee door de fototentoonstelling te lopen, of door Overschie.
Dat ene woord
Column Klokgelui voor Overschiese Krant.
Ik loop de laatste tijd in mijn hoofd met een melodie: 'Niets is sterker dan dat ene woord.' Misschien neuriet u dat ook wel. Welk woord was het ook al weer? Niets is sterker dan dat ene woord: agenda! WhatsApp! Facebook! Succes!
Is het niet zo? Je bent aan het werk, of aan het praten met een vriend of met je kind, en dan komt er een appje tussendoor en je bent afgeleid. Letterlijk afgeleid: je laat je leiden door je telefoon. Je telefoon of je agenda is geen handig hulpje meer, maar is je baas.
Het leven is een nooit eindigend spel. Bij voetbal win en verlies je wedstrijden, en aan het eind van het seizoen is Feyenoord de winnaar. In het leven heb je succesvolle periodes, en op andere momenten zit het tegen of is het zelfs een groot drama, en aan het eind ga je dood. Ik geloof dat er leven is na de dood, maar dat is nu niet mijn punt. Je wordt aan het eind van je leven niet gehuldigd op de Coolsingel. Je hoeft dus niet de eerste te zijn, de beste, de snelste, de mooiste, de slimste. Je hoeft niet de meeste appjes gestuurd te hebben om tot winnaar gekroond te worden in het leven. Er is geen roze trui voor wie het snelste reageert op berichten, of voor wie de meeste volgers op Facebook of Twitter heeft.
Als je bang bent om iets te missen, dan mis je het belangrijkste. Dan volg je aandachtstrekkers en mis je dat wat kalm en bescheiden wacht tot je tijd hebt.
Dus zoek eens de stilte. Geen stilte voor de Twitterstorm, maar stilte voor de stilte. Als stilte saai is, verveling, moet je meer oefenen, het langzaam opbouwen.
Toen Jezus op aarde rondliep, nam hij na de drukte van de dag tijd om met zijn vader te praten. Hij liet zich niet beïnvloeden door politieke of sociale dagkoersen. Hij was sterk doordat hij bouwde op het fundament van zijn relatie met God de vader en belangrijk vond wat de maker van het leven belangrijk vond.
Ja, niets is sterker dan dat ene Woord: Jezus.
Keynote Google - Machine Learning APIs for Python Developers
Keynote talk from Google about Machine Learning APIs for Python Developers, at PyGrunn.
See the PyGrunn website for more info about this one-day Python conference in Groningen, The Netherlands.
Lee Boonstra and Dmitriy Novakovskiy give this talk, they work for Google Cloud, one of the gold sponsors of PyGrunn.
Python at Google
Google loves Python. :) It is widely used internally and externally. We are sponsoring conferences. We have open source libraries, like a Google Data Python Client Library, libraries for youtube, app engine, etcetera. We use it for build systems, report generation, log analysis, etc.
How can you use Google Cloud Platform for your app or website? You can deploy at scale. You can embed intelligence empowered by machine learning, we provide multiple pre trained models. You can use serverless data processing and analytics.
Machine learning
Let me explain it in a simple way. You want to teach something to a kid: what is a car, what is a bike? You point at a car or bike and explain what it is called. With machines we shoot in lots of data and they start to see patterns.
- Artificial intelligence: process of building smarter computers
- Machine learning: process of making a computer learn
Machine learning is much easier.
Our CEO: "We no longer build mobile-first applications, but AI-first."
We have a lot of data, better models, and more computing power. That is why machine learning is happening a lot now.
Google created the open source Tensorflow Python framework for machine learning. And we have hardware to match. We have ready to use models for vision, speech, jobs, translation, natural language, video intelligence.
- Vision API: object recognition (landmarks), sentiment on faces, extract text, detect inappropriate content. Disney game: search with your phone for a chair, and we show a dragon on the chair. Point your camera at a house, and you see a price tag.
- Speech API: speech recognition (write out the transcript, support for 80 languages).
- Natural language API: really understand the text that is written, recognise nouns and verbs and sentiment.
- Translation API: realtime sub titles, automatic language translation using more context than earlier versions.
- Beta video intelligence: label detection, enable video search (in which frame did the dog first appear).
Demo
Go to the Google Cloud console and create a free account to play with. You need to enable the APIs that you want to use. Install the command line tools if you want to run it on your local machine. And pip install google-cloud.
We use machine learning for example in GMail to show you a possible answer to send for an email you receive.
Walkthrough of machine learning and TensorFlow
Google Cloud Dataflow. Dataflow is a unified programming model for batch or stream data processing. MapReduce-like operations. Parallel workloads. It is open sourced as Apache Beam, and you can run it on Google Cloud Platform.
You put files in Cloud Storage. Process this in batches, with Python and Dataflow. This uses pre-trained machine learning models. Then store results in BigQuery, and visualize the insights in Data Studio.
Reinout van Rees - Querying Django models: fabulous & fast filtering
Reinout van Rees talks about querying Django models: fabulous & fast filtering
See the PyGrunn website for more info about this one-day Python conference in Groningen, The Netherlands.
Goal: show what is possible. Everything is in the Django documentation. Just remember a few things you see here.
Example case: time registration system. Everyone seems to do this. A Person belongs to a Group. A Booking belongs to a Project and a Person.
The Python ORM gives you a mapping between the database and Python.
standard:
Person.objects.all()
basic filtering:
Person.objects.filter(group=1)
specific name:
Person.objects.filter(group__name='Systemen')
case insensitive searching for part of a name:
Person.objects.filter(group__name__icontains='onderhoud')
name starting with:
Person.objects.filter(name__startswith='Reinout')
without group:
Person.objects.filter(group__isnull=True)
Filtering strategy:
- sometimes .exclude() is easier
- you can stack: .filter().filter().filter()
- query sets are lazy: only really executed at the moment you need it.
- just assign the query to a variable, to make complicated queries more understandable
- start with the model you want
Speed:
select_related: does a big join in SQL so you get one set of results
prefetch_related: does one query for one table, and then one query to get all related items
if you need only one or two fields, Django does not need to instantiate a model, but can give you a plain dictionary or list instead:
Person.objects.filter(group__name='Systemen').values('name', 'group__name') Person.objects.filter(group__name='Systemen').values_list('name', 'group__name') Person.objects.filter(group__name='Systemen').values_list('group__name', flat=True)
Annotation and aggregation:
- annotate: sum, count, avg
- aggregation
- groupby via values (bit of a weird syntax)
Aggregation gives totals:
from django.db.models import Sum Booking.objects.filter( booked_by__group__name='Systemen' ).aggregate(Sum('hours'))
Annotation adds extra info to each result row:
Booking.objects.filter( booked_by__group__name='Systemen' ).annotate(Sum('bookings__hours'))[10].bookings__hour__sum
Group bookings by year, give sums:
Booking.objects.filter( booked_on__description__icontains='Zwanger' ).values('booked_by__name', 'year_week__year' ).annotate(Sum('hours'))
Practice this with your own code and data! You'll get the gang of it and get to know your data and it is fun.
If you need to do special queries, you can create a sub query yourself:
from django.db.models import Q query = Q(group__name='Systemen') Person.objects.filter(query)
You can write filters that way that are not in default Django.
Twitter: @reinoutvanrees
Òscar Vilaplana - Let's make a GraphQL API in Python
Òscar Vilaplana talks about making a GraphQL API in Python, at PyGrunn.
See the PyGrunn website for more info about this one-day Python conference in Groningen, The Netherlands.
This talk is about GraphQL, Graphene, and Python.
I care a lot about value. If something has no value, why are you doing it?
"Our frontend engineers want us to use GraphQL."
Sample case: there are friends, they have plans, the plans are at a location. So various relations between friends, plans and locations.
With REST you usually fetch too much or too little, you have many calls, some documentation but not really standard, it is hard to discover, not really a standard client, much postprocessing and decisions needed.
So you can try to fix some stuff, giving options to include more data, or not include that many fields. I don't really like it. What can we do?
If you go back to the data, you can see a graph: data that is linked to each other.
"Our frontend engineers want us to use GraphQL. They can just ask for what they want."
In the backend you are trying to decide or guess what the client wants. The client want a nice looking web site. What we have is a bunch of data in too many boring tables.
GraphQL is a query language for graphs. You can ask stuff like this and get data in this format back:
{ plans name description creator: { name } }
You define possible queries:
type Query { plans(limit: Integer): [Plan] } type Plan { ... }
With Graphene you can do this in Python. And there is Django support in graphene_django, to easily wrap this around some models. It is smart about combining queries.
GraphQL makes it easier to expose data. It is closer to the data, so less waste. Easy to get started.
You can play with the GitHub GraphQL api.
Twitter: @grimborg