Posts

Quick and dirty image searches

A quick post about how I tried to find some images with specific dimensions with Google Image Search (GIS in this post). GIS allows to look for defined aspect ratio's. These are broad definitions like 'tall' or 'panoramic'. I was looking for the size of images in pixels. This can be shown over images but isn't an option to finetune searches. So to get what we're after, I had to dive in the raw html of a page with search results. Let's say I search for 'Ramona Flowers'. The resulting page contains plenty of images. Saving the page like one normally would with ctrl+s, 1) doesn't save the images in a useful format, and 2) isn't the html you'd expect. I think Google has a script in place to prevent the most basic scrapers (haven't looked for the answer, I was just working on trying to get what I was looking for). So instead I opened the html source from the page, by pressing ctrl-u (prepending 'view-source:' to the URL is

Evolving an image, part II - image rendering

The second installment in the series on evolving an image with trianges. In this post I will focus on the rendering of the actual image, both for rendering and scoring. Other parts of this series are: Make a generator for the genome. Translate genome to a rendered image. Score the rendered image and compare for evolution. (Optional) Possible optimizations. Scoring generations is done by comparing their matrix representations. At the start of the project I started pretty much blank on the rendering of polygons in python. The Pillow package is primarily meant for graphical implementations, not matrix algebra. My path of drawing polygons on a canvas and then turning the canvas into a matrix representation could just as easily have been reversed. When everything was implemented, the performance wasn't optimal and I looked into mathematical generation of polygons with the shapely module. For now, let's focus on drawing polygons on the canvas. python; genomeGenerator.py

Evolving an image, part I - genome generation

Image
This will be the first post in a series on a simple evolutionary algorithm. The inspiration comes from several blog posts, but primarily from Roger Johansson and Chris Cummins . I haven't really dug through this code, but just started replicating what they wrote and the images they generated. Credits to Pierre Lindenbaum for this image. The plan right now is separated in this rough outline. This is the first instalment, with a focus on generating the data structures that represent a generated image. Make a generator for the genome. Translate genome to a rendered image. Score the rendered image and compare for evolution. (Optional) Possible optimizations. For starters, let's generate random polygons. They have a shape, and a colour. I've decided for now on sticking to just one kind of polygon, the triangle. Perhaps in a later version there could be polygons with more edges, but I'm curious how good generated images could turn out with just triangles. A

I'm moving (already)

After less than a month I've decided that Blogger would be a better place for my blog. I already had a grand total of three posts, and became annoyed by the css capabilities of wordpress.com. I like to have close control over the style of certain html elements, and out of the box the Wordpress style didn't please me. So I resorted to inline css, which is possible with wordpress.com. After some tweaking which also had to be done in the posts I'd already published, and some more tweaking thereafter I knew it was neccessary to 'refactor' the css. Blogger to the rescue, where You actually can add custom css to your blog, without having to resort to the nuclear inline options. So there you have it. Welcome again to my blog, version 0.2. I've migrated all the previous posts (all three of them), and intent (fingers crossed) to stick around a little longer here.

Making a nice screenshot

Image
The main reason this particular post exists is to be able to show something I'm marginally proud of. This is about access to a challenge by Google with little problems to be solved with code, either Java or Python. I would say "bragging rights", but I believe anybody who regularly uses certain search queries on google.com will be offered access to the site eventually. So I wanted to make a screenshot of the webpage. Is any screenshot good enough? No it has to be neat and to my defined size. Can the size of a window be set in Windows? After a thorough search on the internet, no it can't. Are there other possibilities? Maybe it is possible on linux. I have a virtual environment installed with Manjaro (Arch-based), LxQt, and Openbox as a window manager. Am I using x11 or wayland? Find out how to check for that. First check the type of display server. Following this question, querying loginctl show-session <#NUMBER> -p Type , where #NUMBER can be found by

MySQL shortcuts and icons

Image
Having a SQL server available always comes in handy. There are many implementations, most of which are at least partly freely usable. Previously I've worked with an enterprise installation of Windows Server 2008 R2. For my needs, just a stripped down server will suffice. At the time I installed MySQL server, MySQL was probably the most popular open source SQL application. Ever since I've stuck with MySQL. The choice doesn't really matter in terms of functionality, it's just what I've grown accustomed to. With a fresh install of my pc, I had to reinstall MySQL server as well. I always chose for the MySQL Community Server installer, which includes all the MySQL products. This time I wanted a more simple installation, because I realised I didn't really ever use any of the included products. With just the server installed, I also thought it would be neat to optimise my resource usage. By default the MySQL server starts when Windows starts up. This of course isn&#

My todo and wishlist

Welcome to my blog. This is my personal archive. Knowing me, I expect that there will be plenty of sidetracking, drifting and unnecessary eye for detail in some or all posts. I hope others can recognise themselves in the thought processes, and can appreciate the explanations. It's nice to have ideas. When they pop up, I find it hard to also remember them. This list is my memory regarding this blog. Another list, the one I have in my head, has been relieved of at least one item by starting this blog. This list contains items I think I'd like to write about someday. They might be added, disappear and eventually be re-added to this list. In no particular order. No promises. Describe my fancy MySQL buttons . ✓ Make an header image for this blog. I'm thinking of an animated gif, the challenge being that it has to be of a reasonable filesize. Finish the Google challenge. Explore and play with evolutionary algorithms. My