stream

Capital Sharp S in German orthography <2018-09-13 Do>   link

Mark Dominus points to an article from typography.guru: The Capital Sharp S in now part of the official German orthography.

I would be supposed to be learning German but as of today my exposure is still quite limited. I think the only times when I see the letter ß is when reading street signs.

The Utter Failure of Fictional Time Travel <2018-08-07 Di>   link

Perhaps the reason is that no one has (ever) solved the spatial problem, and the cosmos is littered with time travelers adrift between the stars and galaxies.

USDA Pomological Watercolor Collection <2018-07-17 Di>   link

The USDA Pomological Watercolor Collection documents fruit and nut varieties developed by growers or introduced by USDA plant explorers around the turn of the 20th century. Technically accurate paintings were used to create lithographs illustrating USDA bulletins, yearbooks, and other series distributed to growers and gardeners across America.

Kudos to my teacher from last summer watercolor lessons for finding this pearl.

Fruit <2018-07-10 Di>   meta

Today I said: "Cherries are the best fruit with the worst user interface". I love how they taste, but I'm always afraid to choke or break a teeth the on core, I find it annoying to dispose of the petioles, and so on. A colleague replied: "There's a XKCD for that! And he disagrees!". Indeed there is one!

PyData Berlin 2018 <2018-07-07 Sa>   dev meta

First Python conference I attend.

The venue is in the complex of Charité – Universitätsmedizin Berlin: Forum 3 is a nice building and has also some space outdoors (fortunately the conference days were blessed by sun and a nice temperature).

  • First keynote was not strictly related to Python or data science/engineering. It was an extremely interesting, fun and in some moments moving account of the hacker scene in Romania before the collapse of Ceaușescu's regime in the eighties. The story of the COBRA was particularly interesting (COBRA is a Romanian clone of ZX Spectrum, the result of a remarkable process of reverse-engineering, glorious stubborness and sometimes not-strictly-legal work-arounds).
  • Next I attented Five things I learned from turning research papers into industry prototypes. A practical collection of advices if you are tasked with the mission of converting some "theory" from a paper into something executable. Apparently a problem the audience could relate to a great deal. You can find the slides here.
  • Simple diagrams of convoluted neural networks seemed interesting, but unfortunately the presentation was hard to understand to my ears. Anyway, I managed to extract some value from it, mostly because the arguments led me to think about the general problem of devising a notation for expressing and describing a complex system (like a NN): it should make the reader able to follow the process step by step, it should make it easier to spot errors in the system, it should adhere consistently to the metaphor –if any– it decides to follow, it should pay attention to representing clearly what and how it's combined in the various phases of the process, and it should be dynamic (so apparently trying to represent neural networks using a static diagram is a lost cause?). The speaker said that the baseline is currently very low, and there's much space for improvement. The slides.
  • Compared to the previous talk, Launch Jupyter to the Cloud: an example of using Docker and Terraform was very basic but very well presented. The lesson is you can use Terraform and Docker to completely describe (thus making it really reproducible) the entire configuration needed for an experiment (being it some data analysis task, a Jupyter notebook, things like that). The slides.
  • I was particularly excited about the talk coming after the lunch break: Let's SQL Like It's (NOT) 1992! The main point of the speaker is that writing SQL is usually a skill one learns in college, then it's only rarely refreshed and kept up to date with the improvements to the standard. Also, SQL is frequently thought only as a query language, but it actually includes a data modeling language and a data definition language. The presentation was compelling and well delivered (it was actually a live coding session), but unfortunately James run out of time and had to stop abruptly and pass the podium to the next speaker before arriving at the most interesting parts of his talk. He promised to put the code on github. Besides a couple of idioms I didn't see before the talk, I discovered a seemingly useful extension for PostgreSQL, allowing users to implement bitemporal tables automatically (so that it's possible to have usual CRUD primitives, and still be able to reconstruct the state of the dataset at any given time).
  • Next talk was A/B testing at Zalando: concepts and tools. A researcher from Zalando illustrated the tools (and the mindset) they adopted for conducting A/B tests. An endevour they took very seriously, apparently, as they dedicated 3 BE Engs + 3 FE Engs + 4 Researchers + 3 Product managers = 13 persons to it. They developed an internal tool called Octopus and released a OS Python library called ExPan for statistical analysis of randomised control trials. Highlights: one of the attendees asked what are common pitfalls when developing A/B tests. According to the speaker, one is testing too many variables at once (he said they're developing techniques to automatically detect variable "interference" in A/B experiments, such as frontend variations that can reciprocally hinder each other). Another common error is stopping the experiment too early (for example because management wants answers faster), leading to results that have no statistical relevance. He also stressed the point that stats and probability form only half of the picture: business stakeholders need to be involved from the very beginning (e.g. How much running an experiment cost?)
  • Frankly, I chose next talk because I had headache, the other ones in this time slot seemed a bit above my head so I chose something simple: Solving very simple substitution ciphers algorithmically. It was about a toy problem (automatically decyphering mono-alphabetic substitution codes) so nothing new, but what I liked very much is that the speaker was a mathematician, and it was a pleasure following the terse, ordinate and precise explanation ("Let me first name and define a few things").
  • The second keynote of the first day was about GDPR. It was a nice round up from the point of view of the legislator, explaining the principles (old and new) underlying the regulation. The juicy part came during the Q&A afterwards, according to me. First question was about a practical problem that might rise in the context of ML: what if some data a user decided to let the controller store is used to train a model, and then the same user asked for that data to be deleted? Is the model still valid? The speaker explained this is out of the scope by GDPR, it's an open question and she would be interested in reading a paper about that if someone would bother to write one. Second question was a bit of a critique: GDPR is endangering small startups and grassroot association that don't have the resources to implement what's needed for complying with the regulation: the speaker said it's a common problem and added that in her opinion the time (two years, more or less) we had to prepare for GDPR was not very well spent: we should have a platform allowing anyone to comply with GDPR using ready tools. We're not there yet.
  • Last of the first day was the lighting talks session. I particularly like this formula: very brief (5 minutes) but intense talks about various topics, useful for those that had no time to prepare a full fledged about their idea. The most interesting was the "Don't trust your data" talk: a Phd student discovered a dataset about chemical compound skin penetration, used since the 60s is incomplete, yet used over time in many research endevours (such as training 20+ ML models). He went back to the original papers illustrating the dataset, discovered many more features were available, and published a new refined dataset. Certainly a lesson in questioning your input. End of first day.
  • Second day opened with a keynote: Fairness and Diversity in Online Social Systems.
  • Next, mobile.de (an Ebay company) presented the architecture and the tools they use to offer their users a personalized web experience, and specifically to infer future users' behaviour using a stream of events describing their usage of the website. They started using Hive (with Jinja2 to generate SQL queries) but then switched to (Py)Spark, gaining a 5x time improvement and, according to their judgement, a much easier system to understand. They didn't publish the slides but I found some pointers on one of the speakers' personal website: “Which car fits my life?” - mobile.de’s approach to recommendations.
  • In Going Full Stack with Data Science: Using Technical Readiness Level to Guide Data Science Outcomes Emily Gorcenski suggested we could use NASA's TRL (a scale used by engineers to measure progress of technology) adapting it into a "Data Science Readiness Levels" scale. Here the original scale, with a possible translation for software products and for data science projects.

    TRL Product Data Science
    Basic principles observed Need or shortcoming identified Algorithm design & development
    Technology concept formulated Technology concept formulated Data explored and described
    Experimental proof of concept Tests written Experimental proof of concept
    Technology validated in lab Tests passing on dev machines Algorithm validated against sample data
    Technology validated in relevant environment Tests passing in develop Algorithm validated against production data
    Technology demonstrated in relevant environment In QA Algorithm integrated in develop
    Prototype demonstrated in relavant env. Beta version in limited staging Prototype demostrated in operational env.
    System complete and qualified QA passed and ready for staging System complete and qualified
    System proven in operational env. System running in production System proven in operational env.

    She proposed the idea of "full-stack teams" (opposed to full-stack devs, unrealistic if one has to take seriously the amount of knowledge modern system engineering encompasses), and the fact that data science / data analysis is inseparable from the other facets of a software project, since its inception.

  • In Data versioning in machine learning projects Dmitry Petrov started from what I think is a very common problem: we have good tools to manage code versioning, but the same can't be said about versioning data. More generally, he stated that while hardware development has a well established methodology (Waterfall), and software development has one as well (Agile/Scrum), the same can't be said for data related projects. He presented a tool he's developing called DVC, an extension to git (similar to git-annex in some aspects) specifically designed for managing large volumes of data.
  • Big Data Systems Performance: The Little Shop of Horrors by Jens Dittrich was in large part a tirade against the over-hyped terms like "Big Data" &co, that often bring more confusion to clarity when it comes to evaluate and solve a data related problem. This lack of clarity hinders reaching an efficient solution, because the mix three "dimensions" that should instead be orthogonal (as the name he chose suggests): 1. fancy sounding buzzwords, 2. technical principles and patterns, 3. software platforms. He dismissed the first as good only for marketing (he apparently had a bad opinion about marketing), he said being familiar with 3 is important, but even more important is knowing very well 2, because those principles are ubiquitous and more solid. He brought a real life example, where he obtained a 10000x speed improvement applying different patterns and tools from the already existing solution.

First experiences with Python <2018-05-02 Mi>   meta

At the new job I use Python for my programming tasks. Currently developing some data related stuff (ETL and reporting) and a web service, trying to organize the stuff I write so that it can be used by other members of the team for other projects. I will register a few impressions:

  • Overall, I like the syntax. More specifically, I like the fact there are very few principles that uniformly apply in many situations. Most of the time I can "invent" the way something has to be written and it usually turns out as the right form.
  • I like the ecosystem I've seen so far: pandas is a great tool, for example. I'm struggling with SQLAlchemy, but I never quite liked ORMs anyway.
  • I am trying to follow PEP8, even if I have quite different ideas at least about aestethics in code (first time I run pylint on a script I scored -8.61/10).
  • I didn't quite get yet the way modules are organized on the file system.
  • I feel the documentation lacks regularity and completeness. I can find a lot of tutorials about any topic, but I still could not find a systematic source to use as a reference.

Update

Speaking of great tools in the Python ecosystem, I just discovered Jupyter received the ACM Software System Award. Congratulations!

eyebrowse <2018-04-24 Di>   meta

I started using eyebrowse more systematically. I tend to have multiple frames scattered around my xmonad workspaces, but I usually also have a workspace exclusively devoted to a fullscreen Emacs frame, and there I usually work on different projects, that require different windows configurations. So eyebrowse is useful. To be able to switch more confortably from a configuration to another, I added this little piece of code to my setup:

(loop for i from 1 upto 9
      do (define-key eyebrowse-mode-map
           (kbd (format "M-%d" i))
           `(lambda ()
              (interactive)
              (eyebrowse-switch-to-window-config ,i))))

The Oldest Board Game <2018-04-06 Fr>   link

New job! <2018-03-15 Do>

I joined the team of Idagio, a streaming service for classical music.

Which mathematicians were known for their ability to teach? <2018-03-12 Mo>   link

Atreus firmware + Ragel logic <2018-02-01 Do>   link

Excellent content on the Atreus mailing list. An user shows how he used Ragel state machine compiler to implement the logic of his Atreus' controller. Impressive and very interesting.

"Why I (don't) hate LaTeX" <2017-12-06 Mi>   emacs

(via ariis' stream)

I understand and I can sympathize with the nuisances the author mentions (the error messages!), but I do not hate LaTeX.

I use LaTeX for practically everything I need to print. Actually, for most of the things I use org-mode, using its exporter later to obtain a LaTeX or a PDF document – via LaTeX, again – when needed. When I don't need anything special, it's good enough. And it's all plain text, which is also good.

When I need something special, I can thrown in some packages doing the work for me. If I need something very special, well, it might lead me to swearing and tears and whatnot, but I know at the end I'll have something largely more manageable than any other system I know could give me.

Code to read <2017-11-27 Mo>   meta

I opened a new repository on github. It's called code-to-read, an attempt to collect and organize links to code bases particularly good for a human to read.

Pocket Perl ebook <2017-11-24 Fr>   meta

The publisher released an ebook version of my book.

Haskell Day in Rome <2017-11-18 Sa>   meta

haskell-day-rome-2017-group-thumb.jpg haskell-day-rome-2017-room-thumb.jpg

Yesterday I spent the entire day in Rome to attend another Haskell meeting. It's been quite a productive and interesting event: as usual, instead of talks we had impromptu groups engaged in different practical projects. Yesterday, the majority of people followed a beginners course. In my case, I showed my Wiz project to some more experienced programmers, receiving a great deal of observations, questions and suggestions. Other remarks: I saw a "Frankenpad" and learned some details about it; I showed my mechanical keyboards to other aficionados; I unexpectedly received a bottle of Rohrer & Klingner Leipziger Schwarz fountain pen ink (thank you!).

"Lisp is the greatest single programming language ever designed" <2017-10-26 Do>

Another insightful post by Alan Kay on Quora:

One of our many problems with thinking is “cognitive load”: the number of things we can pay attention to at once. The cliche is 7±2, but for many things it is even less. We make progress by making those few things be more powerful.

"The right thing should be easier to do" <2017-09-07 Do>

I register here a series of tweets I already posted, for further ruminations.

One nice thing about Lisp and image based dev environments is that they make the act of exploring easier and more frictionless. This means producing something working is easier, when you're learning a new API or technology. On the other hand they make easier also to transform a crack-fueled idea into something deceitfully working, especially if you don't know well the domain. Thus breaking the rule "Right things should be easier to do", I guess.

August 2017 <2017-09-05 Di>

I spent the entire month in Berlin, half telecommuting, half being my summer vacations. So, I had some free time I spent in many ways, in particular:

  • Riding bike. Berlin is a very nice city to visit with a bike. Most of the streets have room dedicated to cyclists. Gardens and parks are a few minutes away, wherever you are. I guess the average velocity of the bikers is higher compared to Italy. Average attention and respect is higher too.
  • Programming
    • Some progress with my Scheme interpreter, the environment model is kind of working (enabling features like closures), but I'm still having problems with quoting (this is what prevents me from pushing lastest changed to a public repository).
    • Minor fiddling with Lisp, specifically using CEPL (I have I rather ambitious project idea).
  • Reading
  • Painting
    • I was scouting the web for technical conferences to attend, but I found instead a watercolor course for beginners. One could even register for just one lesson. I ended up doing five (7.5 hours total). It was very fun, interesting and useful, absolutely worth the money. And I made some new friends in the process. Call it serendipity.
  • Playing
    • See below about The Swapper

The Swapper <2017-08-19 Sa>

swapper.png

Decided to download a new game from Steam, The Swapper. Interesting game mechanic, and daunting sci-fi setting.

Orankesee (Berlin short bike stroll) <2017-08-06 So>

It's remarkable how easy and quick it is to reach green areas and parks in Berlin. This is a mere 20 minutes from where I'm staying. I took many pictures (they're going to be reference material for future watercolor paintings).

IMG_20170806_110549-thumb.jpg IMG_20170806_111237-2-thumb.jpg IMG_20170806_111759-thumb.jpg

Melvin Decimal System stats on LibraryThing <2017-08-02 Mi 15:50>   books

The Rise and Fall of D.O.D.O. <2017-07-18 Di>   books

dodo.jpg

I started reading last Neal Stephenson's (and Nicole Galland's) novel. I'm only a few dozen pages into the book: it's soon to tell but it seems to be less "hard" SF than then other things I read from Stephenson. We'll see.

CEPL <2017-07-16 So>   dev

This weekend I have been exploring CEPL: "a lispy and REPL-friendly Common Lisp library for working with OpenGL", as its author writes. I have no prior experience with OpenGL, but thanks to Baggers' video series "Pushing pixels with Lisp", and predating the examples I found, I managed to write some working code. I have a project idea in mind, let's see how it ends up.

cepl.jpg

A couple of remarks if you're inclined to experiment on your own.

  • When I started I was not able to run cepl:repl, due to the OpenGL version exposed by my driver (3.0, whereas the mininum for CEPL is 3.1). But that's not the actual version supported by the hardware. To access the real capabilities, and ultimately to be able to run CEPL, you must ask explicitly, for example (cepl:repl 800 600 3.1); I initially missed that, so I spent time trying to solve the wrong problem.
  • I work with xmonad. The default tiled windows positioning is not ideal with the CEPL output window, but thankfully CEPL's window is easy to identify at manageHook level by its title. So I added this in my configuration: <+> (title =? "CEPL" --> doFloat). For example:

    myManageHook = manageDocks
      <+> (title =? "CEPL" --> doFloat)
      <+> manageHook defaultConfig
    

When did you start using Emacs? <2017-06-14 Mi 10:10>   meta emacs

Noticed this Reddit thread in one of Sacha Chua's Emacs News posts, and wondered what I could answer.

~/.emacs.d (master) $ git log --reverse --pretty=format:%ai | head -n 1
2014-05-23 10:29:04 +0200

I didn't realize it's been 3 years already since I started using Emacs.

Record Keeping <2017-04-28 Fr 09:55>   link

Indirect buffers <2017-04-04 Di 11:55>   emacs

Inspired by a post found on the excellent Emacs news curated by Sasha Chua (Replacing Scrivener with Emacs and Vim), I decided to give indirect buffers another try.

Indirect buffers are buffers that share text with another buffer (the base buffer); org-mode, for example, allows the user to display a subtree in a indirect buffer, which might be a convenient way to focus on a particular section of a document.

Convenient but not practical to me, as I keep forgetting the combination used to open that indirect buffer (C-c C-x b), plus the cursor does not move where I'd want it. Here some code I borrowed from the configuration presented in the post: it is very simple, and in my opinion it makes the usage of indirect buffers a lot more pleasant:

(defun open-subtree-in-another-window ()
  (interactive)
  (org-tree-to-indirect-buffer)
  (windmove-right))

(global-set-key (kbd "C-M-l") 'open-subtree-in-another-window)

Wacom tablet <2017-03-26 So>   meta

Quite surprisingly, the rotation property is a property of the stylus and the eraser, not of the pad.

$ xsetwacom --set "Wacom Bamboo 16FG 4x5 Pen stylus" Rotate half
$ xsetwacom --set "Wacom Bamboo 16FG 4x5 Pen eraser" Rotate half

Haskell Day <2017-02-25 Sa>   dev

Haskell Day in Milan, hosted by Mikamai/LinkMe offices.

Games <2017-02-22 Mi 14:54>   meta

I've been playing more than the usual, recently:

  • The Last Door (I played the Android version) - This is a classic point-and-click adventure. Rather simple, but the plot -a homage to Lovecraft's and Poe's horror tales- is interesting. Special mention for the original soundtrack, a real plus in setting the mood. The graphics is intentionally low-res and pixelated, an odd choice that surprisingly played well on a game of this type: I guess it is because the player's mind has to convert the limited detail the images offer into actionable information, thus staying more focused. In practice, I ended up being immersed into the game reality, and that made the scary moments (some of them really upsetting) more effective. Recommended.
  • SIM (Sara is missing) (I played the Android version) - In this game of interactive fiction Sara is missing and you find her smartphone. You're supposed to rescue her, looking for clues in her messages, emails and whatnot, with the aid of Iris, an artificial intelligent system running on her phone. The game is very simple and the player is merely instrumental in letting the story unfold. There are a few scary moments, but in retrospective they were more about how the message was delivered, rather than the message itself. To sum up, the game mechanism is interesting but I would have appreciated a more complex plot.

Mindstorms <2017-02-18 Sa 13:29>   books

Seymour Papert’s Mindstorms was published by Basic Books in 1980, and outlines his vision of children using computers as instruments for learning. A second edition, with new Forewords by John Sculley and Carol Sperry, was published in 1993. The book remains as relevant now as when first published almost forty years ago.

The Media Lab is grateful to Seymour Papert’s family for allowing us to post the text here. We invite you to add your comments and reflections.

xmonad + Libreoffice problems <2017-01-23 Mo 14:00>   meta

Apparently I fixed the pesky problems I had with xmonad + Libreoffice.

xmonad-patch.png

hledger-dupes is now in hledger <2017-01-10 Di 00:41>   dev

Simon Michael asked me to include hledger-dupes in the main hledger repo.

Scheme interpreter going on <2016-12-05 Mo 10:35>   dev

I spent part of the weekend on my Scheme interpreter implementation, after a long hiatus. Cleaned up some code, and started enstablishing the grounds for adding closures (thus passing from the substitution model to the environment model of evaluation, a profound change).

Why Catholics Built Secret Astronomical Features Into Churches to Help Save Souls <2016-11-17 Do 19:16>   link

Quick, How Might the Alien Spacecraft Work? <2016-11-14 Mo 12:00>   link

:syntax off <2016-11-06 So 23:52>

Maybe syntax highlighting is not as good as it seems.

The Case Against TODO <2016-10-28 Fr 17:23>   link

IRCv3 <2016-10-24 Mo 16:37>   link

The IRCv3 Working Group is a collection of IRC client and server software authors working to enhance, maintain and standardize the IRC protocol using backwards-compatible extensions.

A history of storage media <2016-10-12 Mi 16:46>   link

Kiran Bhattaram published a very interesting piece about how storage evolved in computing.

Emacs Lisp's Future <2016-10-10 Mo 15:57>   link

A thread from two years ago reemerged

Writing a test library for Common Lisp <2016-10-04 Di 12:29>   dev

New page, with some notes about the ongoing process of writing a test library for CL (just a toy project, I'm not going to spoil the ecosystem).

"Finding most frequent element in a list" <2016-09-25 So 11:45>   link

A question on Stackoverflow and a brief search led me to some thoughts I want to register to document my learning experience.

First of all, the request specifics are incomplete: what should the function return if there's more than one element that occur most frequently? What is the notion of sameness among the elements of the list?

As a beginner, I often find myself looking for idiomatic ways to do things: reusing code in a package is apparently the way to go, but I haven't found a clear path yet for such researchs: I usually look for something in Quicklisp package collection, then on github and the Clwiki. I suspect that, at least for these simple functions, CL makes it so easy to roll your own version that everybody end up writing a homemade solution.

A-LANG: ways to implement computer languages on 6502s <2016-09-20 Di 09:08>   link

Mac OS X -> Linux <2016-09-19 Mo 23:41>   meta

In other news, I completely switched from Mac OS X to Linux.

The System Paradigm <2016-09-19 Mo 23:40>   dev

I have used a REPL connected to a production system to change code. Yes, I have changed code in a running production system. Does that terrify you? Honestly, it kind of terrifies me a little, too! Regardless, sometimes the best way—the only way—to diagnose a particularly nasty bug is to poke a living organism and observe the result. I am more like a doctor diagnosing a patient and less like a detective trying to piece together a sequence of events from the clues left behind.

There's that and plenty of fascinating observations about the difference between a system constructed as a organism (system paradigm), and constructed as a cathedral (or a pyramid: that's the language paradigm).

I am fascinated, but I'd like to talk to someone who had this kind of experience. I understand the beauty and the utility of the REPL, yet intervening in a system in such a organic and (apparently, to me) not organized fashion seems more dangerous than it's compelling. How one can ensure the changes applied to the running deploy will be incorporated in the code base? How can you properly "undo" the changes you've made while you were tinkering with the system. Anyway, a nice and inspiring post.

The Classics of Science Fiction <2016-09-01 Do 11:14>   link

Status update <2016-08-15 Mo 01:22>   meta

Some days off, not very much done. Somehow relevant in the context of this stream:

  • Writing some simple Common Lisp, for exercise. The Wireworld simulator and editor –which has some significance per se besides being interesting as a CL exercise– is on pause (while I try to figure out Lispbuilder-sdl's ways of treating surfaces), and I'm now on something simpler. It's a Sudoku solver assistant. It's not clear to me what the scope of the project will be, however I'm discovering handy techniques and tools useful for a "real" system: for example I borrowed from scmutils the idea of using TeX to obtain a representation of the Sudoku problem (it's faster than I initially thought).
  • Reading Seveneves by Neal Stephenson. I hope to write something more substantial as I reach its end.

ELisp refactoring tools <2016-07-25 Mo 18:19>   dev

Started working on tools to help me refactor Elisp code. Here the first main function:

(defun create-new-function (function-name)
  "Creates a new function definition, given a selection. Removes
  the selection and replaces it with a call to the newly created function"
  (interactive "sFunction name: ")
  (let ((code (get-region)))
    (progn
      (save-excursion
        (progn
          (move-to-empty-point)
          (insert-new-function-definition function-name code)))
      (insert "(" function-name " )"))))

Comments welcome.

Surprising reasons to use a syntax-coloring editor <2016-07-19 Di 09:14>   link

Mark Jason Dominus on syntax higlighting.

Syntax highlighters should be highlighting the semantic content like expression boundaries, implied parentheses, boolean subexpressions, interpolated variables and other non-apparent semantic features. I think there is probably a lot of interesting work to be done here. Often you hear programmers say things like “Oh, I didn't see the that the trailing comma was actually a period.” That, in my opinion, is the kind of thing the syntax highlighter should call out. How often have you heard someone say “Oh, I didn't see that while there”?

Bit Twiddling Hacks <2016-07-04 Mo 18:34>   link

Automatic webjump list from org <2016-06-28 Di 17:29>   emacs

Webjump is a bookmark facility for Emacs. Fed with a list of bookmarks (as an association list) it presents a menu, then open a browser page with the selected link. Simple and handy.

This function converts my list of bookmarks (expressend in a org document that is also used to build my Links page) in a data structure suitable for webjump.

(defun get-webjump-sites ()
  (with-current-buffer (get-file-buffer "~/Dropbox/stefanorodighiero.net/links.org")
    (delq nil
          (mapcar
           (lambda (i)
             (let ((item-string (cdr (assoc "ITEM" i)))
                   (regex "\\[\\[\\(.*\\)\\]\\[\\(.*\\)\\]\\]"))
               (if (posix-string-match regex item-string)
                   `(,(match-string 2 item-string) . ,(match-string 1 item-string)))))
           (org-map-entries 'org-entry-properties nil 'file)))))

(setq webjump-sites (get-webjump-sites))

Update <2016-06-28 Di 23:26>

I asked for a review on #emacs, bpalmer kindly pointed out a few things that should be done in a different manner:

  • I'm building a list containing nils, which I need to delete later (delq). I shouldn't be creating them in the first place
  • Probably no need for posix-string-match instead of string-match
  • I should provide a docstring

So, here a better version, using the loop macro

(require 'cl)
(defun get-webjump-sites ()
  "converts a org document in a data structure suitable for webjump"
  (let ((regex "\\[\\[\\(.*\\)\\]\\[\\(.*\\)\\]\\]"))
    (with-current-buffer (get-file-buffer "~/Dropbox/stefanorodighiero.net/links.org")
      (loop for i in (org-map-entries 'org-entry-properties nil 'file)
            for item-string = (cdr (assoc "ITEM" i))
            if (string-match regex item-string)
            collect `(,(match-string 2 item-string) . ,(match-string 1 item-string))))))

It's more concise and direct, definitely better, but I'm still not satisfied: it lacks clarity and cleanliness.

New site structure <2016-06-23 Do 22:07>   meta

I just published a restructuring of my website. Content is more or less the same. Main difference is I ditched the blog: I discovered blogging (I mean, organizing the stuff I publish as distinct articles ordered in time) is not for me. I'm more comfortable dedicating a page to each project I'm following, and keep updating the page as the project proceeds.

Ditching the blog also means I'm now using one tool only for all the editing and publishing.

Things to do:

  • testing
  • implement some sort of feed for the updates
  • re-linking minor stuff that has not yet a place in the new structure

Manipulate regions <2016-06-10 Fr 10:09>   emacs

A useful code snippet to manipulate regions.

(defun my/org-convert-region-quote ()
  "Converts selection in a QUOTE block"
  (interactive)
  (progn (insert "#+END_QUOTE\n")
         (exchange-point-and-mark)
         (insert "#+BEGIN_QUOTE\n")))

Knowing about point and mark is useful to understand the code. One defect of this code is that it doesn't work if you select a region starting from the end.

Darius Bacon <2016-06-07 Di 14:40>   link

Oh good lord I found again a web page I was used to peruse like 20 years ago. Many journeys started from there. It's the personal homepage of Darius Bacon.

The Early History of Smalltalk <2016-06-02 Do 10:54>   link

Alan Kay's reading list <2016-05-31 Di 08:46>   link

So you want to be a compiler wizard <2016-05-26 Do 18:36>   link

On Google's last week announcements <2016-05-22 So 09:30>

One of the things presented during the Google I/O I consider particularly important. Some annotations (which might or might not lead to a a more structured piece):

  • it was an error to compare mobile devices to computers
    • computers have protean nature; how they behave (the function they enable) depends on software
    • one chooses what functions his computer needs to perform, and buy appropriate software accordingly
    • On the other hand
    • Mobile devices use the computer and a ground model, but their nature is to be capable of many things off-the-shelves
    • Hence users can legitimately perceive as absurd the fact that software (apps) cost money
    • It feels more natural to pay for services
  • Apps are not human concept
    • I mean the fact that one has to pass from an application to another one to accomplish tasks
    • see for example "The Human Interface" by Jef Raskin
    • On the user level, computer- and human- concepts are intermixed, but there's no human reason to do so
  • Google presented "Instant Apps"
    • it seems they would eliminate to boundaries between one application and the other one
    • the OS is just a framework (with unified interfaces and metaphors) where users can accomplish tasks and access to services
    • OS seamlessly manages the acquisition of other components (modules? apps bits?) needed to do so

Nowadays, we do programming by poking <2016-05-04 Mi 18:13>   link

http://www.posteriorscience.net/?p=206 https://vimeo.com/151465912#t=59m36s

Today, this is no longer the case. Sussman pointed out that engineers now routinely write code for complicated hardware that they don’t fully understand (and often can’t understand because of trade secrecy.) The same is true at the software level, since programming environments consist of gigantic libraries with enormous functionality. According to Sussman, his students spend most of their time reading manuals for these libraries to figure out how to stitch them together to get a job done. He said that programming today is “More like science. You grab this piece of library and you poke at it. You write programs that poke it and see what it does. And you say, ‘Can I tweak it to do the thing I want?'”. The “analysis-by-synthesis” view of SICP — where you build a larger system out of smaller, simple parts — became irrelevant. Nowadays, we do programming by poking.

Dyson's Dodecahedron <2016-05-01 So 11:47>   link

A nice collection of hand-drawn RPG maps

Isabella the Catholic brings change to Chess <2016-04-18 Mo 12:29>   link

Org as a Word Processor <2016-04-02 Sa 12:12>   link

"Learning Racket" series <2016-03-29 Di 16:37>

An expert programmer learns Racket and takes notes in the process. Many interesting remarks, for example (after discovering a library that let the user bend the language):

It must be any language designer's ultimate dream.

(And this is probably Lisp's greatest weakness as well – with this level of possible diversity, everyone has to use the “common lowest denominator” simply because nobody can agree on what alternative syntax / library / etc. is better and should be used.)

Switched to Ubuntu Xenial Xerus <2016-03-29 Di 10:38>   meta

Better hardware support with less work for me (the Broadcom Wifi chip has been recognized with no problems).

eshell and why can't I convert to you <2016-03-03 Do 08:51>   link

Some interesting Emacs shell tricks in this Reddit thread.

The Lisp Curse <2016-02-26 Fr 17:13>   link

Interesting read, that resounds with something we were talking about at last Haskell meetup.

Lisp is so powerful that problems which are technical issues in other programming languages are social issues in Lisp.

Consider the case of Scheme, again. Since making Scheme object-oriented is so easy, many Scheme hackers have done so. More to the point, many individual Scheme hackers have done so. In the 1990s, this led to a veritable warehouse inventory list of object-oriented packages for the language. The Paradox of Choice, alone, guaranteed that none of them would become standard. Now that some Scheme implementations have their own object orientation facilities, it's not so bad. Nevertheless, the fact that many of these packages were the work of lone individuals led to problems which Olin Shivers wrote about in documenting the Scheme Shell, scsh.

What are some of the must-read, harder Sci Fi books you all recommend? <2016-02-19 Fr 15:02>   link

R setup <2016-02-06 Sa 11:46>   dev

I need to setup a R environment on the Linux machine. RStudio (which I'm currently using on my Mac) eases packages installation and at the same time provides a rich and pleasant to use environment, but I'm considering going for a different setup on my Linux machine. For example, one way could be using Debian packaged R plus Emacs ESS.

Farewell, Marvin Minsky (1927–2016) <2016-01-27 Mi>   link

Especially interesting is what Minsky observes about teaching programming languages:

I remember a few years ago bringing up the topic of teaching programming, and how I was hoping the Wolfram Language would be relevant to it. Marvin immediately launched into talking about how programming languages are the only ones that people are expected to learn to write before they can read. He said he’d been trying to convince Seymour Papert that the best way to teach programming was to start by showing people good code. He gave the example of teaching music by giving people Eine kleine Nachtmusik, and asking them to transpose it to a different rhythm and see what bugs occur. (Marvin was a long-time enthusiast of classical music.) In just this vein, one way the Wolfram Programming Lab that we launched just last week lets people learn programming is by starting with good code, and then having them modify it.

A surface code quantum computer in silicon   link

How modern languages will save the text editor   link

Interesting post about programming language writing tools.

[…] the languages were developed in complete ignorance of these tools, which made them somewhat hostile to those goals (anybody who tried to implement a correct C++ parser knows what I mean, life before clang was just painful). As a result, very complex tools making heavy use of specialized partial parsers, static analysis, and crazy heuristics emerged. And they emerged as part of even more complex development suites to combine them all in a coherent form: the IDE was born.

[…]

But more recently, things took a different turn (for the best I think): a new language emerged that was promoting a different paradigm: Go. Instead of making the tooling an afterthought, it’s been pretty much there at some level since inception. It even shows in the language grammar itself, which is designed to enable fast compilation, partial parsing, and a whole bunch of analysis tools.

It resonates with an old paper I'm reading: Programming in an interactive environment the “LISP” experience by Eric Sandewall.

Black Hole, by Bucky Sinister <2016-01-02 Sa 19:44>   books

black-hole.jpg

The best things and stuff of 2015 <2016-01-02 Sa 12:33>   link

The annual post by Fogus. Great stuff.

Yay! New laptop <2015-12-20 So 10:35>   meta

Now some work to make it work like I want (it comes with Windows 10 installed but I want a GNU/Linux system on it. So far I've only tried a live distro to check hardware support. As I expected, it's going to need some work to make the wifi chipset work properly).

Update

Linux installed. First update from the new environment!

Creating Adventure Games On Your Computer

by Tim Hartnell, published 1983

cover-thumb.gif

(I found this reference in an excellent post by Michael Fogus)

Early Christmas present   books

feynman-lectures-small.jpg

The only way to beat this would be giving me more time to read it. (It's a wonderful boxed-set edition of the famous Feynman Lectures on Physics)

Untangling the Tale of Ada Lovelace

Nice post on Stephen Wolfram's blog ("In other words, she basically proposed to take on the role of CEO, with Babbage becoming CTO").

How to get good at chess, fast <2015-12-09 Mi 13:09>

Adding dashboards to hledger <2015-12-08 Di>   dev

I spent a couple of days trying to hack some changes into hledger-web. I use it from time to time, especially to visualize the item tree generated from my journal, but I would need more to incorporate it in my workflow. What I would like is a system to describe arbitrary widgets to compose in a dashboard. Things like "monthly expenses, comparing this and last year, using a histogram". Or "breakdown of the top N expense categories, using a pie chart".

So far, I just built some familiarity with the codebase and I managed to obtain a static (I mean, non-configurable) dashboard with a single widget showing my monthly expenses. Like that (code is on github):

dashboard_-_hledger-web.png

But the real problem is designing a sensible dashboard configuration language.

Chris Wellons: 9 Elfeed Features You Might Not Know <2015-12-05 Sa 09:56>   emacs

A list of interesting elfeed tricks

Update <2015-12-06 So 09:57>

I spent some time fiddling with my elfeed configuration. I like the interface and the way one could program and extend it. Here some more resources I found useful:

Update <2015-12-07 Mo 09:00>

Some times elfeed gets stuck while downloading the feeds. Reading a relevant issue on github, I discovered the function elfeed-unjam that fixes the problem.

Programming Interactive Worlds with Linear Logic <2015-11-29 So 11:20>   link

Logo-ish drawing environment <2015-11-27 Fr 23:25>   dev

Some months ago I bought a copy of "Turtle Geometry". I am looking for a LOGO environment to follow along and do the exsercises, but I could not find anything good enough for Mac OS X (which is quite surprising, if you ask me). So I decided to write my own version. The first usable thing I produced is not quite LOGO, but enough to do fancy drawings and (I'm guessing) translate most of the exercises without efforts. Code is on github.

screenshot.png

Update <2015-11-29 So 09:39>

One thing I'm not sure how I could do is the interactive environment, but I discovered I have something acceptable at no cost, thanks to how Lisp and the lispbuilder-sdl package work.

Here a piece of code from my project:

;; [...]
    (with-events ()
      (:quit-event () t)
      (:key-down-event (:key key)
                       (when (sdl:key= key :sdl-key-escape))
                       (sdl:push-quit-event))
      (:idle (reset-turtle)
             (fancy 20)
             (draw-turtle *position-x* *position-y* *direction*)
             (update-display)))))

Since we're implicitly using the :poll event mechanism, the :idle event is triggered at each "game loop" iteration. Thus, if I redefine the functions used in the body associated to the :idle event while the program is running, I obtain a different drawing. What I do, at the end, is:

  • evaluate (main) (the SDL window appear)
  • focus in the Emacs window
  • edit some relevant functions (for example the body of fancy)
  • C-x C-e to re-evaluate the definition
  • voilà, new picture is drawn

A Basis for Concurrency and Distribution <2015-11-27 Fr 12:00>   link

Spoiled by xmonad   meta

I'm doing some experiments with xmonad and I particularly like its mod-Space key combination to switch the window layout in a workspace. Is there something similar for Emacs?

This is similar to what I want: ThreeWindows

Update <2015-11-15 So 11:51>

I ended up doing this (the entire code is here: larsen-functions.el)

(defvar *larsen/split-layout-type* t)

(defun toggle-split-layout ()
  (interactive)
  (progn (change-split-type-2 *larsen/split-layout-type*)
         (if *larsen/split-layout-type*
             (setq *larsen/split-layout-type* nil)
           (setq *larsen/split-layout-type* t))))

(global-set-key (kbd "M-<f1>") 'toggle-split-layout)

John Wiegley on git <2015-11-05 Do 18:03>

From emacs-devel mailing list:

One thing to keep in mind is that Git has several distinct layers:

  • The data model
  • The plumbing
  • The porcelain

The data model is incredibly simple. This, I think, is Git's main attraction. I've written about the data model in my article "Git from the Bottom Up", and also via a Haskell library for interacting with this model, called gitlib (http://hackage.haskell.org/package/gitlib).

The plumbing is… unintuitive to say the least. The porcelain is… fairly bad, but slowly getting better.

lispbuilder-sdl <2015-10-28 Mi 22:43>   dev

Tried to install listbuilder-sdl via quicklisp, but got stuck on cocoahelper dependency. Is it supposed to work on Yosemite?

<2015-10-29 Do 21:46>

Managed to install the library on a Linux virtual machine. Tried Asteroids to test it.

Collection of CSS styles for org <2015-10-28 Mi 09:04>   link

A thread on Reddit with pointers to CSS styles for org-mode HTML export.

A neat tmux trick [2015-10-19 Mo 09:31]   dev

Francesco showed me his tmux conf. This is particularly useful:

bind . send-keys B Space E Enter

Clojure: If Lisp is so great, why do we keep needing new variants? [2015-10-14 Mi 14:20]   link

The one thing that Lisp programmers can agree on is how much better Lisp is than C and similar languages. I was talking last week to some programmers who use the Clojure version of Lisp and it made me wonder “If Lisp is so great, why did this guy have to build a slightly different version instead of building a popular application program in an existing version of Lisp, such as Common Lisp?”

Interesting discussion in the comments

Old but interesting <2015-10-09 Fr 16:19>

Published the interview with Oliver Charles <2015-10-09 Fr 12:23>   meta

Trying Spacemacs <2015-10-07 Mi 22:06>   emacs

In a virtual machine, to avoid compromising my existing main setup

The installation process seems to be smooth.

It asked a couple of questions: one mysterious about the environment I would prefer, and another one about the initial settings (minimal or not) I'd rather use.

Initial setup finished with no errors

Which is good. The only problem –if one wants to be picky– is that the status line looks messy, probably due to a lack of proper fonts.

I try to venture in the scratch buffer

I have, somehow, Vim keybindings and Emacs' ones. So for example I can edit some Elisp expression using "Vim" then evaluate it with C-x C-e. I think there are people that were burned like witches for much less.

spacemacs-small.png

I'm surprised

I had the uneducated conviction that with evilmode (on which Spacemacs is based, if I understood correctly) one could either use Vim bindings or Emacs' ones, choosing on a buffer basis. And that seemed unconvenient and unpractical to me. I should dig deeper, but this mixture seems well conceived and sound. As I wrote in another place, quoting Nic Ferrier, Vim is a superior editor, but Emacs is a superior environment to write editors. And Spacemacs is a proof.

Just arrived: Land of Lisp <2015-10-06 Di 17:52>   books

lol1.jpg

Finished Anathem <2015-10-05 Mo 23:36>   books

Software I'm looking for <2015-10-02 Fr 11:56>   meta

Switching theme <2015-09-25 Fr 16:27>   emacs

When you use load-theme the chosen theme is applied together with any other theme precedently activated. This small function could be useful to switch theme instead of just pushing another one on the stack.

(defun switch-theme (theme)
  (interactive
   (list
    (intern (completing-read "Switch to custom theme: "
                             (mapcar 'symbol-name
                                     (custom-available-themes))))))
  (dolist (curr custom-enabled-themes) (disable-theme curr))
  (load-theme theme))

Attended Yoox techevents.yooxlabs.com <2015-09-22 Di 19:00>

Giraffe: Using Deep Reinforcement Learning to Play Chess <2015-09-15 Di 15:47>   link

Freer Monads, More Extensible Effects <2015-09-15 Di 15:46>   link

Trying to configure ox-rss.el <2015-09-13 So 18:43>   meta

I'mq trying to properly configure ox-rss.el to produce a feed for this stream.

Computer Science Courses that Don't Exist, But Should <2015-09-13 So 10:01>   link

Genius at play <2015-09-09 Mi 08:32>   books

genius_at_play.jpg

A biography of John Horton Conway. Arrived on Monday.

The present in deep history <2015-09-08 Di 08:33>   link

Charlie Stross on his blog:

Assume you are a historian in the 30th century, compiling a pop history text about the period 1700-2300AD. What are the five most influential factors in that period of history?

The comments are interesting.

Upgrading Haskell on my system <2015-09-06 So 17:30>

(all started trying to do some experiments with Servant)

Monkey Island turns 25yo <2015-09-04 Fr 15:33>   link

I can't even start telling how much is significant to me.

Urania 1622 <2015-09-04 Fr 08:55>   books

urania1622.jpg

I'm told that Bruce Sterling now lives in Italy, in Turin. This is a collection of stories set around Italy. Just skimmed the very first pages so far, I noticed an overflow of the word "occult".

I have history back to ~2003. <2015-09-04 Fr 08:52>   link

TMK firmware <2015-09-01 Di 18:34>

Trying the tmk firmare on the Atreus. The feature list is very interesting, but it's not clear to me if it's all appliable to the specific hardware I'm using.

Typing analytics <2015-09-01 Di 08:34>

I wish I could be able to measure my typing speed in a consistent manner, and without recurring to tools external to my flow. Ideally, it would be something sitting behind and observing my keyboard usage as I work.

First Atreus mod idea <2015-08-31 Mo 18:55>

I'd like to attach a wire to the board's pins that pilot the LEDs, thus being able to see when I'm on a certain layer.

hakyll deploy command <2015-08-31 Mo 12:47>   dev

Hakyll allows users to configure a deploy command:

Next question is: how could I add more commands?

Post: Double feature keyboard review <2015-08-30 So 15:54>   meta

Width-adaptive XMonad layout <2015-08-30 So 10:15>   link

I thing this will be handy in the future

DateTime::Duration <2015-08-28 Fr 17:10>   dev

Here a surprising feature in [[][DateTime::Duration]]'s API. What this code will print?

use strict;
use warnings;

use DateTime;
use DateTime::Duration;

my $dt1 = DateTime->new( year => 2015, month => 8, day => 1 );
my $dt2 = DateTime->new( year => 2015, month => 8, day => 31 );

my $duration = $dt1->delta_days( $dt2 );
print $duration->days();

It prints 2, because the days() method is implemented as

abs( ($duration->in_units( 'days', 'weeks' ) )[0] )

meaning that the duration is first converted to weeks, then the remainder is returned.

Here an extended piece of code to show what happens:

use strict;
use warnings;

use DateTime;
use DateTime::Duration;

my $dt1 = DateTime->new( year => 2015, month => 8, day => 1 );

foreach my $d ( 2 .. 31 ) {
  my $dt2 = DateTime->new( year => 2015, month => 8, day => $d );
  my $duration = $dt1->delta_days( $dt2 );
  printf "%s days and %s weeks\n", $duration->in_units( 'days', 'weeks' );
}

which prints:

2 days and 0 weeks
3 days and 0 weeks
4 days and 0 weeks
5 days and 0 weeks
6 days and 0 weeks
0 days and 1 weeks
1 days and 1 weeks
2 days and 1 weeks
… and so forth

If you want to know how many days there are between two given dates, better be explicit and use $duration->in_units('days').

The doc explains it clearly if you take the time to read it:

These methods return numbers indicating how many of the given unit the object represents, after having done a conversion to any larger units.

But it's baffling to me nonetheless.

How recursion got into programming: a comedy of errors <2015-08-28 Fr 13:04>   link

Anathem, by Neal Stephenson <2015-08-28 Fr 08:30>   books

~15% into the book. Some action. I'm not complaining, I think this prolonged immersion in the concent's life will be crucial – not just colour, I mean – to comprehend the plot that is unfolding.

Light Up <2015-08-27 Do 22:50>   dev

Simon Tatham's Portable Puzzle Collection is a nice collection of puzzle games that should be interesting to solve automatically. I installed the Android version of the collection and played a little with Light Up.

You have a grid of squares. Some are filled in black; some of the black squares are numbered. Your aim is to ‘light up’ all the empty squares by placing light bulbs in some of them.

Each light bulb illuminates the square it is on, plus all squares in line with it horizontally or vertically unless a black square is blocking the way.

To win the game, you must satisfy the following conditions:

  • All non-black squares are lit.
  • No light is lit by another light.
  • All numbered black squares have exactly that number of lights adjacent to them (in the four squares above, below, and to the side).

Non-numbered black squares may have any number of lights adjacent to them.

First thing, board representation and some diagrams code to obtain a graphical rendition.

lu.svg#org18473d6

import Diagrams.Prelude
import Diagrams.Backend.SVG.CmdLine

data Square = Empty
            | Box
            | Light
            | Lamp
            | Num Integer

type Board = [[Square]]

board :: Board
board = [[Empty, Box,   Light, Empty, Box,   Empty, Empty],
         [Empty, Empty, Light, Empty, Box,   Empty, Num 0],
         [Box,   Num 2, Lamp,  Light, Light, Light, Light],
         [Empty, Empty, Light, Empty, Empty, Empty, Empty],
         [Empty, Empty, Light, Empty, Empty, Num 1, Num 1],
         [Num 2, Empty, Box,   Empty, Empty, Empty, Empty],
         [Empty, Empty, Num 1, Empty, Empty, Num 0, Empty]]

squareSize = 30

drawSquare Empty = square squareSize
drawSquare Box = square squareSize # fc black
drawSquare Light = square squareSize # fc yellow
drawSquare Lamp = circle (squareSize * 0.3) # fc white
               <> square squareSize # fc yellow
drawSquare (Num n) = text (show n) # fc white # fontSize (Local 16)
                  <> square squareSize # fc black
drawBoard :: Board -> Diagram B R2

drawBoard b = vcat . map (alignR . hcat) . (map . map) drawSquare $ board

sketch = drawBoard board

main = mainWith sketch

twitter followers == 0? <2015-08-27 Do 08:49>

Apparently my Twitter following/followers counter has been reset to 0.

Fixed <2015-08-27 Do 09:25>

which-key <2015-08-26 Mi 18:24>

@manuel_uberti wrote about which-key, a package that displays available keybindings in popup. Manuel shows an example to activate it:

(which-key-mode)

(setq which-key-idle-delay 0.5
                which-key-key-replacement-alist
                '(("<\\([[:alnum:]-]+\\)>" . "\\1")
                  ("up"                  . "↑")
                  ("right"               . "→")
                  ("down"                . "↓")
                  ("left"                . "←")
                  ("DEL"                 . "⌫")
                  ("deletechar"          . "⌦")
                  ("RET"                 . "⏎")))

State of the Common Lisp Ecosystem, 2015 <2015-08-26 Mi 09:06>   link

an observation <2015-08-26 Mi 08:49>

So, apparently the code highlighting I get publishing a org document gets affected by the current theme in Emacs (note to self: using the cyberpunk theme produces unreadable code on white background).

wiz <2015-08-25 Di 22:53>   dev

Trying to expand the vocubulary of my interpreter including graphic primitives.

  • The environment will get enriched with a list of Pictures that together compose the Sketch we want to draw (I'm using Gloss)

    data Sketch = Sketch [Picture]
      deriving (Eq)
    
    data Environment = Environment (Map.Map String Expression) Sketch
      deriving (Eq)
    
  • The Sketch is drawn at the end of the repl session (meaning that we accumulate Pictures to be drawn all together at the end of the session: I intend that only as the first step, I want an interactive environment where the user can have instant feedback on the picture he's composing). Something like that:

    draw sketch = Graphics.Gloss.display (InWindow "wiz Test" (640, 480) (10, 10))
       white (drawSketch sketch)
    
  • So, we pass from two to three effects evaluating an expression can have:
    1. Returning a value
    2. Changing the symbol table (part of the environment)
    3. Adding a picture in the sketch (part of the environment)

I hoped to be able to include the third effect in the eval function, but so far that's only able to return values, without affacting the environment. I guess this was a poor decision, that needs to be amended.

ghci <2015-08-25 Di 21:53>   dev

ghci + Gloss don't play well on my system. I need to do

ghci -isrc -fno-ghci-sandbox src/Main

Ron Gilbert on Thimbleweed Park <2015-08-25 Di 08:51>   link

Saving games still scare me.This is something I should have figured out months ago. The issue isn't a matter of how to store the data, it's way more complex than that. There is a lot of data to iterate through and save off in a way that can be reconstructed. Doing save games is harder today than it was back in the SCUMM years. Back then we didn't have to worry about patching. These days, the save game has to survive the game being patched and that can mean resources being added or removed.

Ryan Carmack's game <2015-08-24 Mo 23:13>   link

Ryan is John Carmack's son.

I’m still taking a little heat from my wife for using an obscure language instead of something mainstream that is broadly used in industry, but I have nothing but good things to say about using Racket and DrRacket for a beginning programmer, and highly recommend it.

wiz <2015-08-24 Mo 23:02>   dev

I wanted to do some progress on the Scheme interpreter, but I ended up instead fixing code that went on github by mistake, and fighting with some git nuisances.

Anathem, by Neal Stephenson <2015-08-23 So 10:43>   books

I'm currently approximately 5% through the novel. I still have only faint ideas about what's going on. Not yet alarming, by my count.

Clojure IDE <2015-08-22 Sa 19:11>   dev

Spent some time setting up a development environment for Clojure using Leiningen + Emacs + CIDER + clj-refactor. Still confused by some parts of the system but I can see how pleasant it can be.

Meeting J-Bob: Notes on "The Little Prover" Chapters 1-5 <2015-08-21 Fr 10:01>   books

The Little Prover <2015-08-20 Do 11:18>   books

the-little-prover-thumb.jpg

Just arrived. It's printed in colours!

I didn't have the courage to ask the courier about two more books I'm waiting for: he seemed very pissed off for the problems he had finding my address.

How to Help Self-Driving Cars Make Ethical Decisions <2015-08-19 Mi 09:46>   link

They implemented different ethical settings in the software that controls automated vehicles and then tested the code in simulations and even in real vehicles. Such settings might, for example, tell a car to prioritize avoiding humans over avoiding parked vehicles, or not to swerve for squirrels.

As the technology advances, however, and cars become capable of interpreting more complex scenes, automated driving systems may need to make split-second decisions that raise real ethical questions.

At a recent industry event, Gerdes gave an example of one such scenario: a child suddenly dashing into the road, forcing the self-driving car to choose between hitting the child or swerving into an oncoming van.

“As we see this with human eyes, one of these obstacles has a lot more value than the other,” Gerdes said. “What is the car’s responsibility?”

Measuring things <2015-08-18 Di 22:09>   dev books

I use org-mode for registering the books I read. Here some code to produce stats.

;; Is there a better (more idiomatic) way to aggregate values?
(defun aggregate (aggregate-function lst)
  (let ((hash (make-hash-table :test 'equal)))
    (loop for key in (mapcar 'car lst)
          for value in (mapcar 'cdr lst)
          do (if (null (gethash key hash))
                 (puthash key value hash)
               (puthash key (funcall aggregate-function value (gethash key hash)) hash))
          finally return hash)))

(defun pages-per-month-raw ()
  (with-current-buffer (get-file-buffer "~/org/books.org")
    (mapcar (lambda (b)
              (let* ((month (format-time-string "%b" (date-to-time (cdr (assoc "TIMESTAMP" b)))))
                     (pages (string-to-int (cdr (assoc "PAGES" b)))))
                (cons month pages))) 
            (books/in-year "2015"))))

(defun pages-per-month ()
  (let ((ppmr (pages-per-month-raw)))
    (aggregate '+ ppmr)))

(defun month-list ()
  '("Jan" "Feb" "Mar" "Apr" "May" "Jun"
    "Jul" "Aug" "Sep" "Oct" "Nov" "Dec"))

(defun complete-hash (hash)
  (let ((new-hash (make-hash-table)))
    (loop for month-name in (month-list)
          do (if (null (gethash month-name hash))
                 (puthash month-name 0 new-hash)
               (puthash month-name (gethash month-name hash) new-hash))
          finally return new-hash)))

;; Poor man's TSV export
;; TODO check the implicit assertion on the ordering
(maphash (lambda (k v) (insert (format "%s\t%s\n" k v)))
         (complete-hash (pages-per-month)))

Then, for example:

stats <- read.csv("/tmp/stats.tsv", sep = "\t", header = F)
names(stats) <- c("month", "pages")
stats$month <- factor(stats$month, month.name )
p <- ggplot( stats, aes(month, pages)) + 
    geom_histogram() + 
    theme(axis.text.x = element_text(angle=45, hjust=1))
p

book-stats.png

"With great power comes a really shitty UI" <2015-08-18 Di 14:53>

Installed the Chicken Scheme interpreter <2015-08-18 Di 09:50>   dev

The Turing Digital Archive <2015-08-17 Mo 18:14>   link

Basic setup <2015-08-17 Mo 16:46>   dev meta

Basic stream setup done.

Anachronistic computing <2014-10-13 Mo>

Yay! The laptop I recently bought for a ridiculously low price is eventually working like I want.

x32.png First its characteristics:

CPU Intel Pentium M (Dothan)
RAM 512MB
HDD 40GB 2.5" PATA
Display 12.1" TFT with 1024x768 resolution

It is a IBM Thinkpad X32. A good news is it sports one of the best keyboards one can find on a laptop (and I was lucky enough to find the GB layout). I found it at an electronic fair I recently visited, and grabbed it without much thinking from the pile (literally) where it layed together with some of its twins.

I think it's remarkable that such an old piece of hardware can be a perfectly usable machine (at least for the way I'm used to work). All it takes is some attention to the software one chooses to install:

  • Linux, obvious choice to revive old hardware (in this case, I had to recur to a non-PAE kernel due to the particular CPU architecture)
  • i3, a lightweight tiling window manager
  • Emacs 24.3, where I'm going to spend much of my time (w3m is a decent surrogate of a proper graphical browser for reading documentation)
  • I'm even running Hakyll locally to prepare this post

The Internet with a human face <2014-08-18 Mo>

An interesting talk by Maciej Cegłowski.

bt14.012.jpg

Anyone who works with computers learns to fear their capacity to forget. Like so many things with computers, memory is strictly binary. There is either perfect recall or total oblivion, with nothing in between. It doesn't matter how important or trivial the information is. The computer can forget anything in an instant. If it remembers, it remembers for keeps.

[…]

Our lives have become split between two worlds with two very different norms around memory.

[…]

The online world is very different. Online, everything is recorded by default, and you may not know where or by whom. If you've ever wondered why Facebook is such a joyless place, even though we've theoretically surrounded ourselves with friends and loved ones, it's because of this need to constantly be wearing our public face. Facebook is about as much fun as a zoning board hearing.

2011 in books <2011-12-31 Sa>

Essays/Computer science/$work stuff

In 2011 I started my adventures in the perilous lands of bigdata, so I've begun harvesting literature on the subject. Extremely interesting and relatively young field. I have an almost finished review of "Data Analysis with Open Source Tools" which I hope to publish soon.

Novels

My first encounter with Douglas Coupland. I particularly liked Microserfs, that somehow seemed to be speaking directly to me. Perhaps not for everybody.

Five minutes after Games of Thrones s01e01 I realized I couldn't wait an entire week to know the rest of the story. Still entertaining, after ~3000 pages and already in the fourth book.

I'm a hardcore Neal Stephenson fan. I also have Anathem in my stack, but I decided to read Reamde first, because it seemed less dense. It was, and also more fast-paced than usual.

How fast my git repositories are growing <2011-08-06 Sa>

I wrote a very small utility to gather LOC counts from a git repository. Called gitsloc, it's based on Cloc, with some extra goodness provided by Sysadm::Install (a rather inaptly named module, if you ask to me, but full of useful gems).

I guess it could actually have some uses, who knows?, but I wrote it mostly because I wanted to see how fast repos are growing, and R is the obvious tool to tinker with the results.

I'm less than a beginner with R, and I have to admit plotting data from a multi-column CSV file is less straitghforward than I expected: I had to use =xyplot= from the lattice package, like this:

xyplot(
  Perl + Bourne.Shell ~ 1:nrow(sloc),
  data = sloc,
  type = 'a',
  auto.key = list( space = "top", lines = TRUE, points = FALSE)
)

Here the result, with data provided analysing the Dancer github repository (branch devel).

Rplot01.png

Kindle first impressions <2011-04-17 So>

I just unboxed my Kindle. I played with it for a few hours only, but I'm satisfied with the choice so far.

First of all, to the zealots that may happen to read this article and feel compelled to whine on "scent of paper" and other oddities: I'm not planning the disposal of all my "real" books, neither I'm considering buying only digital contents from now on.

I decided to buy an ebook reader because I wanted to see on my own what can be done with this technology, which I consider immature and yet to be completely exploited.  I think I am an early adopter, even if Amazon Kindle and its competitors hit the market several years ago.

Also, I think having an ebook reader is nowadays the most practical solution to the eternal problem "What books should I bring with me during the journey?". Being able to answer "All!" is a wild dream that comes true (but I understand this can be a problem as well).

Anyway, here a few impressions from a very very beginner.

  • The device itself looks beautiful. It's not heavy and it seems prolongated use will not be tiring. On the other hand, I have the impression it's not particularly sturdy. Again, this is something I can say only in a few months (or in a few hundreds kilometers).
  • I think the slogan "it's like paper" is inaccurate.  Whatever appears on the screen seems printed, but it does not recall paper to me.  Besides that, fonts are very  crisp and readable, so Kindle hits on the spot for what is supposed to be its  main use.
  • I am positively surprised by the refresh delay. Maybe because  I expected it to be even worse, I think it's bearable, at least for the kind  of books you read cover to cover in a sequential fashion. In other words, good for novels, articles and stuff like that; maybe not practical for manuals, documentation… in general, things you want to study, or browse randomly.
  • I suspect I will eventually feel hampered by the position of buttons on the device. Anyway, this can't be but a speculation.
  • I'm currently at my parents' place, and there are problems with the Internet connection, so I couldn't try its wifi capabilities yet. A pity: one of the things I was more eager to try was Kindle's use in conjunction with Instapaper.
  • Ah, the screensavers are wonderful!