Saturday, 31 December 2022

Write a book: tick

Yesterday I finished the book I have been slowly writing for the last year or so and now I just have to wait a couple of weeks until the (very) few printed copies that I have ordered are delivered. This is a book strictly for my family, however I want to share a couple of insights.

First off, memories, like love, die if you don´t take care of them. Nothing lasts forever.

Did everything really take place as we remember it? What makes it into such a book? And for the same token, what does not make it into such a book?

Which are the landmarks of our existence? Extraordinary events? Routine ones which are quickly forgotten although they make up for the bulk of our time? Or maybe just the people who surround us?

Well, I don´t have the answers. On the other hand, I do now have a book with 350 pages full of things that came to my mind which I thought were worth writing down for my children. And the feeling I could have written more and with more details. So maybe all I got round to do is writing the first part of a bigger book, maybe one to be completed in fifteen or twenty years if I am still around.


And Happy New Year!

Thursday, 22 December 2022

Photos in 2022


Deciding which photos are "best" is always a difficult task. On the other hand, checking which ones got more likes in IG is dead easy. I post a mix of new and old photos, and from the ones taken in 2022, these are the photos with most likes (around 15 likes each, give or take).

The trick is that the amount of likes is more or less proportional to the number of people which your photos are shown to, which in turn depends on the hashtags you use. If, like me, you don´t use hashtags often, very few people will see your photos. For B&W photos I have a set of three hashtags which I use regularly, #streetphotography, #blackandwhite and #blackandwhitephotography, and not surprisingly these are the photos which get most likes. More hashtags, more likes, but also more time required each day and since I only spent a couple of minutes each morning to post a photo, I just cannot be bothered with the whole game.

Friday, 18 November 2022

Por si las moscas

Aprovechando que puedo usar la API de twitter para el bot del calendario, he creado un programita para descargarme las listas de seguidos y seguidores en twitter (muy modestas). Nunca se sabe. 

def write_file(tweepy_function, screen_name, file_name):
    #https://stackoverflow.com/questions/52450621/get-list-of-followers-and-following-for-group-of-users-tweepy
    csvFile = open(file_name+'.csv', 'w')
    csvWriter = csv.writer(csvFile)
    c = 1
    for page in tweepy.Cursor(tweepy_function, screen_name=screen_name, count=200).pages(50):
        for user in page:
            csvWriter.writerow([user.screen_name, user.id, user.url, user.location, user.followers_count, user.friends_count, user.description.encode('utf-8')])
            print(c, ',', user.name, ', @'+user.screen_name, user.url)
            c+=1
    csvFile.close()
    return None

def main():
    api = get_tweepy_api() #tweepy.API(auth)
    screen_name = "your_handle_without_@"
    write_file(api.get_followers, screen_name, 'followers')
    write_file(api.get_friends, screen_name, 'following')

Saturday, 12 November 2022

Progress report

Writing a book takes time and while it has taken me a bit longer than expected, I am making progress. So much so that I am already thinking of printing it. However this post is not about content and rather about technical issues.

I found a print on demand service, very aptly called Book on Demand which seems reasonable. Truth be told, I did not spend a lot of time doing research comparing features and prices. For what I want (printing about five books for the family) any book service will do. This one offers what I assume is the usual selection of soft cover and hardcover, paper weights, color vs B&W and a long list of other options. You can pay for many things, or do it all yourself (my case). Not quite unexpectedly, my book has a ton of photos (more on that later), and it would be nice to print them in color, except that obviously not every page has a photo, only about one third of them. I am currently at over 300 pages (A5), and that´s a lot of pages to print black text in "color", which would be too expensive. Luckily, there is an option to enter the list of pages which should be printed in color, which reduces the price significantly.

The way I saw it there were two main options:

Option A: Finish the pdf and make a note manually of which pages have photos. This would take about ten minutes, maybe fifteen minutes?

Option B: Write some code that inspects the pdf and spits out the list of pages with photos. Who knows how long this takes, for sure more than 15 minutes as there are likely many unknown unknowns, plus I have no idea about structure of pdf files.

It goes without saying that I went for Option B. Adn even writing this post took more than 15 minutes.

On to the tech details. I ended up installing PyPDF2 and following this. But for some reason my pdf has many images in all pages (I generate it from LibreOffice, no idea if that makes a difference).

Since the easy way did not work, I did it the hard one, aka the fun way, opening the pdf file as a text file (ignoring utf-8 errors and not even bothering to uncompress the pdf file first) and peeking into it until I figured out the following.

There is an object which gives some information about pages in the pdf (my pdf currently has 317 pages). I just had to figure out what those numbers followed by '0 R' were about.

1487 0 obj
<</Type/Pages
/Resources 1524 0 R
/MediaBox[ 0 0 419 595 ]
/Kids[ 1 0 R 4 0 R 7 0 R 10 0 R 13 0 R 16 0 R...
56 0 R 60 0 R 64 0 R 69 0 R 74 0 R 78 0 R 81 0 R...
122 0 R 125 0 R 128 0 R 131 0 R 135 0 R 138 0 R...
...
1045 0 R 1048 0 R 1051 0 R 1054 0 R 1057 0 R 1060 0 R...
...1120 0 R 1123 0 R 1126 0 R 1129 0 R ]
/Count 317>>
endobj
990 0 R 993 0 R 996 0 R 999 0 R 1002 0 R 1008 0 R...

Turns out that searching for "images" I found the list of my inserted images. Something like 

34 0 obj
<</Type/XObject/Subtype/Image/Width 881 /Height 644 ... /Length 122470>>
stream
JFIF
O]NV
...

And putting two and two together I figured out that the first list has the first object that goes in that page, so first page has objects 1 to 3, second page objects 4 to 6, etc. I know that the first page with an image is the 11th one (at least in this iteration of the book), which would include objects 31 to 34 and, bingo, the first image is object 34. To do another I checked the last page with a photo in my pdf (288th page), and the object range also includes the object listed for the last image. So that seems to be it, actually a lot easier than expected.

This takes less than 30 lines of code, and this remind me of the Automate the Boring Stuff with Python book, by Al Sweigart. And yes, it took me more than 15 minutes, but I am sure I will make changes to the output pdf, and if nothing else, this has been way more satisfying than doing it manually. I don´t get to code any more at work and sometimes I miss it.


Sellos (VIII)


 

Ùltima entrada (por ahora) de esta serie programada con sellos de Italia, Grecia, España y Alemania

Friday, 11 November 2022

Sellos (VII)

 


Sellos de Egipto, un montón de sellos de Grecia :-)

Thursday, 10 November 2022

Sellos (VI)

 


Sellos de España, Suiza, Paises Bajos y Francia.

Wednesday, 9 November 2022

Sellos (V)

 

Sellos de España, Singapur y Alemania . De estos me quedo con Mortadelo y Filemón y el de Feliz Año, al que la foto no hace justicia (en general todas las fotos dejan que desear)

Tuesday, 8 November 2022

Monday, 7 November 2022

Sellos (III)

 


Más sellos de Italia, Francia, India y Reino Unido

Sunday, 6 November 2022

Sellos (II)




Más sellos, incluyendo algunos de sitios como Irlanda o Estados Unidos, y otros más cercanos como Illescas, Leganés o Salamanca.

Saturday, 5 November 2022

Sellos (I)

 


Poniendo un poco de orden, me he entretenido en hacer fotos de algunos sellos del montón de cartas que tengo guardadas (no todas porque eso sería una tarea hercúlea, aunque quizás lo haga poco a poco). Por ahora he resistido la tentación de leer las cartas (algunas no he podido evitarlo, confieso).


Tuesday, 1 November 2022

Playing with AI tools

Good ideas often come from exchanges with interesting people. In my case, I saw this tweet from Molinos last Summer and thought it should be relatively straight forward to do something similar as a DIY project, but instead of quotes with the time, quotes with the date. The only issue was how to figure out a quote for every day. Scraping huge amount of books is an option although, honestly, it looks like a bit of a daunting task. There are Wikipedia articles of things that happened on a given date. And of course there are always searches in Google that can be parsed. I was just finishing my holidays and I did not have neither the time nor the energy to try anything at the time, so I put it in the back of my mind.

Fast forward to today, I am on holidays and I recently saw a post of somebody who had added a GPT-3 function to a google sheet to autocomplete columns. I had the Eureka moment that GPT-3 could probably complete the task with an adequate prompt, so I decided to give it a try and was amazed how easi it was to accomplish something (not saying that the something was any good, keep reading). These are some of the autogenerated results for a few dates:

"The first of January is the day on which we all start afresh, with new aspirations and hopes for the coming year." - The Alchemist, Paulo Coelho

"Second of November, huh?"
-The Catcher in the Rye, J.D. Salinger

"It was the third of November. The wind was howling outside, and the rain was beating and splashing against the windows."
-The Adventures of Sherlock Holmes, Arthur Conan Doyle

"The Fourth of November is a date which we should never forget."
- A Tale of Two Cities, Charles Dickens

"Remember, remember the Fifth of November, the Gunpowder Treason and Plot, I know of no reason why the Gunpowder Treason should ever be forgot."
-V for Vendetta, Alan Moore

The one question I have though is if the quotes are real or if they are autogenerated but fake. A bit of googling did not really answer the question since just because you don´t find something it does not mean that it doesn´t exist. And of course there may be different versions of a book if it has been published multiple times. 


I have been changing the prompt to try and provide as clear instructions as possible. This is the latest prompt I am using with the davinci engine:

Quote from a book in the public domain including  either "first of November" or "November, 1st" and mandatorily using the exact text in the book. Next to the quote, add the title and author of the book from where it was extracted.  The quote must be less than 200 characters. If no exact quote available containing the required text, don´t invent a quote, just write "quote not found". Case of words is not relevant.


GPT-3 is not deterministic, so you can run several times the same prompt and see what comes out. For example, this is an interesting coincidence...

"First of November was a cold day."

The Tale of Peter Rabbit by Beatrix Potter


"First of November was a cold day."

The Call of the Wild, Jack London


"First of November was a cold day."

-The Adventures of Sherlock Holmes, Arthur Conan Doyle


The books and authors definitely exist. Whether the same sentence exists in all books, I don't know. I tweaked the prompt from "the exact text in the book" to "the exact text from the book" and got this.

"First of November, 1892," he said. "I shall never forget it."

The Adventures of Sherlock Holmes

by Arthur Conan Doyle


"First of November was come, and many little birds were dead; but Mrs. Partington said they might have died any day, so it was no matter."

The Life and Adventures of Mrs. Partington

by Kate Douglas Wiggin


I wonder if I should do a twitter bot similar to the CalendarPuzzle bot.


Edit: Instead of creating another bot, I just added the quote to the existing one. Let´s see how it works in the next few days.

Saturday, 8 October 2022

Street Art: El Bocho

 


I went for a walk today in Charlottenburg and took my camera hoping to take the one or the other photo and I had a blast in the ninety minutes I was aroung. The icing on the cake was a really nice series of street art which I found just by chance. Turns out they are all painted by El Bocho

Saturday, 1 October 2022

Sunday, 11 September 2022

Still posting a photo every day

 


The questionable design choice for this collage is because I do collect photos at irregular intervals (ie, whenever I remember I have not done it in a long time). And of course they don´t fit in a square or rectangular form. Since I had to leave some spaces or rearrange the whole lot, I went with the usual approach "do what you can with what you have".

Also remarkable is the obvious lack of style. Some people only ever post black and white, others mostly portraits, or street photography. I just seem to be all over the place. Which is fine. Enjoy the weekend.

Saturday, 10 September 2022

Breitenbachplatz (v)


This is a draft which was never posted. I cannot even remember why not. I guess at the time I did not like the oversaturated colours, or maybe I had already posted too many photos of Breitenbachpatz.

Better late than never.

Sunday, 21 August 2022

Kraftwerk Peenemünde

We spent the holidays in Usedom and one day we rented some bicycles to visit the Museum in Peenemünde, which is really nice and one of those places where it is easy to take good photos. I have been posting them in the insta account, with still a few more to come..



Tuesday, 24 May 2022

Serenity in Alcalá (ii)

 


Muchísimos años sin vernos (demasiados) y lo primero que hicimos fue disfrutar de una exposición de Quino en la Capilla del Oidor, luego dar un paseo por el centro de Alcalá y finalmente ir a cenar para darnos cuenta que era como si no hubiera pasado el tiempo.

Wednesday, 4 May 2022

Serenity in Alcalá

 


Two years without going back to Spain. About to get back home now with a handful of nice photos and a load of memories



Sunday, 20 March 2022

Tirando del hilo

Esta entrada en realidad fue un hilo de twitter

Inspirado por el grandísimo Jaime Obregón os voy a contar una historia, porque en todos sitios cuecen habas. Como cada año por estas fechas se abre el plazo para inscribir a los niños españoles residentes en el extranjero en las Aulas de Lengua y Cultura Españolas, las famosas ALCE.

Las clases son gratuitas, mitad presenciales y mitad online, aunque muchos españoles ni siquiera saben que existen. Los detalles los puedes leer en el BOE

Cuando eres emigrante te puedes registrar en el Censo Electoral de Residentes Ausentes en el consulado correspondiente (las rimas las carga el diablo) para poder votar acercándote al consulado (si es que te pilla razonablemente cerca).

Y esto qué tiene que ver, dirás. Pues que el consulado tiene una lista de españoles (no todos porque algunos siguen empadronados en España) así que sería muy fácil mandarnos un mensaje en febrero recordándonos que nuestros hijos pueden acceder a las ALCE.

Parece ser que en algunos países sí que se hace y en otros no con excusas como que la ley de protección de datos lo impide. A ver, que no te pido que me des los datos de los españoles registrados, te pido que les mandes tú un mensaje igual que haces con las elecciones.

Pero claro, si nos apuntamos en masa nos harían falta más profesores. Porque por ley, si hay un grupo de más de catorce alumnos el estado tiene que poner un profesor. Y eso cuesta dinerillo.

Vale, que sí, pero ¿y esto qué tiene que ver con el grandísimo Jaime Obregón ? Ya llego, ya.
(en realidad esto es otra excusa para enlazar a alguien y que Jorge Corrales note que leo sus tuits)

Cada niño español en Berlín en edad escolar está escolarizado en un colegio alemán. Ya que el consulado no nos avisa, ¿y si les pido a los colegios que avisen a los alumnos españoles de que ALCE existe? La información es pública. Más o menos. Está aquí.

Hay muchos colegios en Berlín y cada dirección de correo está disponible (una a una que si no sería todo demasiado fácil). Lo que no hay (o yo no he encontrado) es una lista con todos los colegios. Pero bueno, para eso sirven los scripts de usar y tirar 

Vale, ya tengo la lista de colegios y sus direcciones. ¿Mando un mensaje masivo que sea ignorado por todos o un mensaje a cada colegio e instituto que sea ignorado individualmente? Casi mejor uno a uno pero no a mano, que aquí hemos venido a jugar.

Una búsqueda en google con las palabras "python gmail send email" me devuelve un puñado de tutoriales, a cual mejor. ¿Victoria?
Este enlace no tiene nada que ver con este hilo pero es interesante (no es que el hilo no lo sea)

Casi, para empezar un 6% de las direcciones devuelven un error porque o son viejas y ya no se usan pero tampoco te dicen cual es la dirección nueva, o directamente ya no existen, o están tan llenas que ya no aceptan más mensajes. Bueno, mejor que nada. Y claro, ¿cuantas veces recibes un mensaje de un desconocido, extranjero por más señas, que te pide hacer algo y lo haces enseguida? Pero incluso si con los 900 mensajes solamente se acaba apuntando un chico o una chica, pues habrá merecido la pena.
Si quisiera hacer lo mismo a escala nacional la cosa sería incluso más complicada. Por ejemplo, sé de alguien que quiere montar una ALCE en Potsdam, pero ¿cómo te pones en contacto con los españoles allí?

El consulado tendrá sus razones para no usar la información que tiene (repito, no quiera que hagan público el registro del CERA) pero podían tomar nota de sus compañeros en Países Bajos. Este año el plazo acaba el 25 de marzo.


 


Saturday, 5 March 2022

Propuestas para cambiar la resolución que regula las ALCE

La Unidad de Acción Educativa Exterior ha estado recogiendo sugerencias para elaborar una posible modificación de la Resolución de 2019 que regula el funcionamiento de las ALCE. Dentro de este proceso está contemplada la participación de las familias. Para ello se creó una consulta pública en la que cualquiera podía aportar sugerencias.

Yo aporté mis sugerencias mandando este documento.


Sunday, 13 February 2022

Aulas de Lengua y Cultura Españolas - 2022

Esperemos que se apunte mucha gente


Queridas familias:

 Desde la dirección de la ALCE de Hamburgo, queremos comunicarles que el plazo de inscripción para el nuevo curso 2022-23 comenzó 7 de febrero hasta el 25 de marzo.

 Para este curso la inscripción se va a desarrollar de forma digital. Es necesario que confirmen, cumplimentando la solicitud de continuidad, que quieren que sus hijos continúen en el programa ALCE para el próximo curso 2022-23. Se trata de un formulario muy sencillo.

 Formulario de continuidad_ALCE Hamburgo (incluye Berlín, Leipzig, etc)

https://forma.administracionelectronica.gob.es/form/open/corp/8313/jtiO

Si tienen hijos que cumplan 7 años o más en el año 2022  y quieran inscribirlos, lo pueden hacer a través del formulario de nueva inscripción que les envío a continuación:

 Formulario nueva inscripción_ALCE Hamburgo (incluye Berlín, Leipzig, etc)

https://forma.administracionelectronica.gob.es/form/open/corp/8297/GqrG

En este formulario de nueva inscripción tienen que adjuntar los siguientes documentos escaneados, sin que supere cada documento 2 megas:

- Fotocopia del DNI por los dos lados o pasaporte español de su hijo/a.

        Si no lo tuviera necesitaría una copia del DNI o pasaporte español del padre o la madre y una fotocopia del libro de familia de las páginas donde aparezcan los datos de los padres y de su hijo/a.

- Schulbescheinigung del colegio alemán como que está matriculado su hijo/a en el colegio o que asiste a las clases.

Este formulario de nueva inscripción se utiliza también para aquellos alumnos que hayan causado BAJA justificada y deseen volver a inscribirse.


Les agradecería mucho que, si conocen a alguna familia interesada, le puedan enviar el enlace de nueva inscripción o les puedan recomendar que se pongan en contacto conmigo.

 

A modo de recordatorio, para las nuevas familias interesadas, los requisitos para poder matricularse en el Programa ALCE son los siguientes:

- El alumno debe tener nacionalidad española o, al menos, que la tengan el padre o la madre.

- Que el alumnos/a cumpla 7 años o más en el año 2022 y no haber cumplido 18 el día del inicio de curso escolar.

 

Muchas gracias por su colaboración e interés.


María del Mar Rojas Carmona

Directora ALCE Hamburgo

Chilehaus Eingang B, 1 Etage

Fischertwiete 1, 20095 Hamburg

Tel.: +49 40 530205295

Email: alce.hamburgo@educacion.gob.es

http://www.mecd.gob.es/alemania/

Saturday, 15 January 2022

Microsot Word vs LibreOffice Writer

 

I started writing a book and chose to do it using LibreOffice Writer. Today I was exploring whether to change to Word, since now I happen to have a Microsoft365 licence (for other reasons). Very disappointed to see that in Word I cannot display my document in book format (ie left page showing on the left and right page on the right as you would expect it and how it is shown in Writer). The side by side option in Word just does not cut it.

Sorry Microsoft, but do better, this is very disappointing. And even if the option exists in some obscure setting somewhere, not good enough.

One cheer for open source software.

Edit: Found this query from 12 years ago (!). Not good.