# They wouldn't fill a post

“ Geometry was discovered by the Egyptians as a result of their measurement of land. This measurement was necessary for them because of the inundations of Nile, which constantly washed away the boundaries between shares of land. ”

Aleksandrov/Kolmogorov in "Mathematics: Its contents, methods and meaning"
* Geometry comes from ancient Greek and means land‐measurement, where ''ge'' is land and ''metron'' is measure.

Combining various shapes on the screen to achieve a desired effect is also an example of geometry in action. The “land” isn't fixed, but a product of our imagination and abilities. We start with a white space whose boundaries seem infinite, spanning across multiple screens. If we place a white circle on the page, there will be geometry, but no perception of it. By adding the code that enables this and keeping the visual design intact, we introduce waste. We still can't measure anything on the screen except its dimensions. Only when we create new, visible elements do we have a representation of an idea that can be evaluated from a conceptual and measured from a geometric point of view. The way the various elements relate to each other is then a question of similarity, position and proportion. Similar triangles have the property that AB1/AB2 = AC1/AC2, which can be measured. The radius of a circle or the diagonal in a rectangle can also be calculated easily. The distance between elements is of interest in the Gestalt principles. It is virtually impossible to craft a website by neglecting dimensions entirely. But a sense of size isn't the same as the measure of size. Measuring distances improves the visual design in the same way that unit testing improves the code. A test that returns a value close enough, but not equal to what was expected fails; similarly, we need to explore ways to let a distance that was close enough, but not equal to the planned one fail too. Otherwise harsch events will only increase our margin of error over time, leading to greater inconsistencies. The boundaries of our creations matter too, since we need to define a territory and build on a solid base for the long term rather than seek to expand into an infinite playing field.

There are many types of trees in computer science and sometimes it is not enough to know what a binary trees is in order to be able to keep a conversation. There are also AVL trees, Fibonacci trees, scapegoat trees, red-black trees, quadtrees and octrees, 2-trees, 2-3 trees, B, B+ and B* trees, R-trees, Hilbert R-trees, ternary trees, suffix trees, splay trees, randomized trees, segment trees, alphabetic trees, lopsided trees, bit pattern trees, fusion trees, filter trees, finger search trees, fieldtrees, kd-trees, k-d-b trees, hybrid trees, buddy-trees, buffer trees, cell trees, balanced aspect ratio trees, strip trees, margin trees, shade trees, shrinking trees, fixed-query trees, kB-trees, LSD trees, hB trees, BV-trees, PK-trees, O-trees, CIF-trees, CSG-trees, PQ-trees, range trees, metric trees, decision trees, bintrees, boxtrees, top trees, cover trees, interval trees, conjugation trees, M-trees, BD trees, BBD trees, X-trees, BV-trees, CB-trees, TPR-trees, TV-trees, PK-trees, pB+-trees, PC-trees, SR-trees, MV3R trees, MX-trees, RC-trees, SB-trees, SBC-trees, SS-trees, HV-VH trees, OBB-trees, ATrees, AABB-trees, Huffman trees, Delta-trees, Cartesian trees, van Emde-Boas trees, Steiner trees, Delaunay trees. Although this seems like a rich variety, there are possibly many other tree types that haven't been included here. It's an interesting aspect of trying to represent data through trees that seems worth sharing.

Memory leaks can lead a quiet life. They won't inform us of their occurrence, but if we have observed long enough how a machine performs under a variety of circumstances and loads, we start to develop an intuitive feeling of when things could be slowing down due to a memory leak. If we don't pay attention to the machine, we would need to open the task manager anytime we suspect strange behavior. This interrupts our work and consumes additional resources as well.

Although I was aware of a tool like Selenium, I was reluctant to use it for a long time as I didn't find it convenient enough for frequent use. Combining it with phpUnit required much more code than I was willing to write or able to track. My opinion about it still hasn't changed radically, but at least I found a way to test it. Selenium can direct the browser to a chosen URL and perform automated keyboard and mouse actions on preselected page elements. We can select them by tag name, id, CSS or even XPath. Unit tests can helps us track whether the browser responded to the event in an expected manner. Selenium can work with most browsers which may also help to identify browser-specific bugs (although we shouldn't be writing our code in a way that causes them). It supports phantomJS—a headless browser that remains hidden from us, but is still able to type and click on any element on the page. This means that, in theory, we should be able to execute our tests faster, but without seeing the results visually (and whether things worked as we wanted them to look). We have to rely entirely on the correctness of the unit tests—something which is not easy to guarantee. PhantomJS worked as expected and I saw some tests passing and others failing. But then I noticed that my PC started to slow down although I was “closing” the driver instance at the end of the script. The task manager showed many instances of PhantomJS running, each one taking approx. 60MB memory. It turned out that other people were already discussing the memory leaks with PhantomJS on StackOverflow. After spending some time on individual process killing, I was convinced that invoking a Firefox instance might be a better choice. This time everything worked, the browser started (with a bit over 80MB memory cost), some actions were executed and I was even able to see their effect. But everything happened so fast, that I could barely see it. Now I needed to introduce some waiting time in order to see exactly what was happening, but this meant to write even more code. I found that the 20MB additional memory cost was well worth for the increased stability and visual control it allowed, but your requirements may call for another option. A common error I had was the StaleElementException, which occurs when actions are executed in order, where we have preselected all elements we want to work with in advance, but an action changes the page in a way that invalidates the references to the rest of the elements. A possible solution to this seemed to be either to select only the element which would be immediately acted upon or use an action chaining API specifically for this task.

A recent paper whose title I no longer remember claimed that MySQL is in most cases sufficiently fast compared to other databases like Cassandra, HBase, Voldemort, Redis and VoltDB. It claimed that on a single node Redis and VoltDB were approx. 2x faster than MySQL in terms of operations/sec, but they found that Redis ran out of memory on multiple nodes, whereas MySQL was still able to handle such load. Each database had its own set of issues, as they explained in the benchmarks. The plots revealed that although a bit slower, in most cases MySQL wasn't considerably slower than its competitors. This served as a motivation to update my old MySQL version. The latest publicly available installer I tried (5.6.21) failed with a bug during installation, so I installed 5.6.20 instead. At one point I realized that the MySQL daemon was silently consuming 400MB of memory, without further notice. A fix for this was to add table_definition_cache = 200 in my.ini under the list of mysqld configuration paramters. After this the memory utilization fell to approx. 80MB. Memory leaks are so common that they should be expected.

Sometimes we need to explore the data we have to look whether there are some visible patterns in it. Matlab is one option to do this, but it may not be universally available. R is fast, powerful and free, but more directed to statisticians than to programmers (which can be seen from the package repository). Designing the plots can be time-consuming. Numpy, Scipy and Matplotlib are another option that allows data exploration while not trying to interfere with the programmer's work by introducing separate GUI windows. This combination works fine for the majority of cases, except when we realize that the features of Numpy and Scipy are a small subset of what we see mentioned on the Arxiv. Another disadvantage is that these libraries aren't supported by many hosting providers, which means that we can't use them to compute the results dynamically, but have to revert to using a static image on the page. We should ask ourselves whether their features would be enough for our purposes or whether we would need a more powerful toolbox. It can be painful to start a project only to find out that it won't be possible to finish it in the way we wanted. Recently I have found Scilab, which is another free alternative that packs many features in a simple interface. Typing “help” in the console reveals what it is capable of. Its syntax is very similar to that of Python, although loops are written slightly differently and ranges are defined with start:step:stop instead of start:stop:step. The disp() function can be used to output data from within a loop, but as expected, this is not very fast. Otherwise we can just type any meaningful operation and the output will be presented in the console. What I liked about Scilab is how it handles matrices. We can type a matrix on many lines using only a single pair of brackets on the start and end lines respectively. In contrast, we either need to type a pair of brackets for each line of the matrix in Python or use the Numpy's reshape(rows, cols) function after we have entered a single long line of values. In Scilab values in matrices are divided by space and not by comma, which I think leaves less opportunity for mistakes. Plots in Scilab don't look as exciting as in other packages (which may be important when preparing a presentation), but this helps us focus on the meaning of the data and not so much on its appearance. The main goal of plotting data is to seek insight. Try it and see whether it will work for you.

Elementary operations like addition, subtraction, multiplication and division are often among the least costly in a computer program and they also seem to be the most boring to talk about. But these aren't operations that we perform once or twice. They can be performed hundreds of thousands of times per second when we consider that many functions use them. Each dynamic change of a value requires an elementary operation and its through these changes that programs become alive. Does this mean that because they are elementary operations, they are all alike in terms of performance? Early tests have revealed that in C addition and subtraction are almost 3x faster than multiplication and division (integers only). The slowest operation on integers was approximately as fast as the fastest operation on floating point numbers. Addition and subtraction were approx. 33% faster than multiplication and division (floating point numbers). Sine was 240x slower, logarithm was 260x slower and square root was 285x slower than integer addition (the fastest elementary operation). These numbers seem impressive today to believe that we can perform 260 additions for the same amount of time we compute a single logarithm. In a simple JavaScript test, I found subtraction to be the fastest elementary operation and the power function to be the slowest among sine, cosine, logarithm, exponent, square root. In terms of performance the difference between them was just around 33%, which is nowhere near the factors seen above. Sometimes, more computationally heavy operations can be replaced with elementary ones like multiplication even when this wouldn't make immediate sense. In his talk “Making things with maths”, Steven Wittens' mentioned the idea that everything in maths is a choice and it doesn't even need to make sense, when we can “invent” the math through a combination of “lego pieces” to fit our goals. We don't need to be mathemagicians or understand math in detail in order to see how changing the functions changes their behavior. A powerful idea, highlighting again the importance of data exploration.

Creating object-oriented JavaScript is not always easy, especially when the project grows and becomes harder to maintain. But people like Mary Rose Cook make things look easy by demonstrating how to create a game from scratch. Making things simple can be hard, which is why real-time coding while explaining the rationale behind every decision can be so valuable to a broad audience. Exploring how the various objects interact is useful in any OO context, not just in developing a game. I still think that using frameworks ca reduce flexibility, even when in the short term it makes us feel more productive. I find that part of the programmer's job is to remove dependencies of any kind, instead of actively introducing them for the sake of convenience. Even when you don't understand everything, it is still well-worth watching her talk.

Stanford University and Ycombinator have started a course called “How to start a startup” that might be interesting for you. All videos are publicly available without registration, which supports a more open web. Although there are many interesting points, Sam Altman has warned at the start that some of the advice may or may not work for you, depending on your situation. This is why without questioning, automatic acceptance of any advice would be wrong. Recently, Peter Thiel said: “Begin by studying the end game”, but this isn't how most people tend to think. We expect everything to be fast and smooth, but the reality is that it takes many years before the first fruits of effort start to show. We need to prepare ourselves for the future and anticipate it or at best, any success will only be temporary. Another interesting lecture.

bit.ly/11fAQT0