A Graphviz Go-By

When I want a graph like this:

example-graph.png

my go-to tool is the dot command from Graphviz. There’s a simple input language to describe a graph that’s easy to write by hand but most often I generate the input programmatically. It’s the perfect way to let a program generate graphical output.

Graphs like the one above are really easy to generate but dot is much more powerful. Adrian Ancona has an excellent post that serves as a go by for many of the basic dot capabilities. You can control the shape, color, and other attributes of the nodes and edges.

I found Ancona’s post really useful. It’s easy to look at the pictures to find one that more or less matches what you want and see the corresponding spell to generate it. If you, even occasionally, need to generate a graph, you should consider bookmarking the post—I have.

UPDATE [2020-06-12 Fri 13:35]: Added link to Ancona’s post.

Posted in General | Tagged | Leave a comment

Emacs Comment Functions

Bozhidar Batsov over at Emacs Redux has taken some time off from his open source projects such as rubocop, nrepl, cider, prelude, projectile, and many others to write a useful post on the various Emacs commenting commands. It turns out that there are a lot of them but like most of you, I long ago settled on comment-dwim (bound to Meta+;) because I thought it handled all my normal commenting needs more or less automatically. It was nice to need to remember only one command that handles everything.

I said “thought it handled” rather than “think it handles” because Batsov’s post mentioned another command I didn’t know about: comment-line. It handles all the cases I care about that comment-dwim does but also handles deleting the comment on the current line, which is a bit clumsy with comment-dwim. Batsov says he much prefers comment-line and has changed the Meta+; binding to run it instead.

The other commenting command that I occasionally find useful is comment-box. I like to use it for section headers or just before C functions. What I don’t like about it is that the width of the box is scaled to fit the comment width. I prefer to have it spread across the page width. I wrote about that here but the code is short so here it is again in case anyone is interested:

(defun jcs-comment-box (b e)
  "Draw a box comment around the region but arrange for the region
to extend to at least the fill column. Place the point after the
comment box."
  (interactive "r")
  (let ((e (copy-marker e t)))
    (goto-char b)
    (end-of-line)
    (insert-char ?  (- fill-column (current-column)))
    (comment-box b e 1)
    (goto-char e)
    (set-marker e nil)))

As Batsov says, comments are an important part of programming and it’s worth learning the tools that Emacs provides to make using them easier. Take a look at his post to see what’s available.

Posted in General | Tagged | Leave a comment

More Google Suits

A week ago I wrote about Arizona suing Google over data collection. Arizona’s complaint is that Google collects location information even if you turn it off. Since that data collection was for maps and weather, I was willing to give Google the benefit of the doubt but I did wonder why that same information has to be recorded and sent to Google.

Now a new suit filed in California alleges that Google tracks and collects consumer browsing history and other web activity data no matter what safeguards consumers undertake to protect their data privacy. The suit notes that although Chrome offers a “private browsing” mode, Google still collects browsing information from other tools. One way is the popular Google Analytics software that many sites use to track page views. That works by sending information about you to Google when you visit a site that’s using Google Analytics. The suit names Google Ad Manager as another tool used to gather browsing data.

The suit is being handled by Boies Schiller Flexner LLP, a firm well-known for high profile litigation in the Tech arena and other areas. Similar suits have been dismissed so the outcome of this one is anything but certain. The main takeaway seems to be that no matter what Google says or how often they’re fined, they’re going to keep right on doing what they do. That’s not surprising; it’s an existential matter for them.

Posted in General | Tagged | Leave a comment

Editor Keystrokes

It’s surprising to me that many people still don’t know where some of the keystrokes we use everyday in our editors came from. The most famous example, I suppose, is why Vi(m) uses the j k h l keys for cursor navigation but there are others.

The thing with Emacs and Vi is that they’re really old for software and when they were developed, keyboards didn’t look at all like they do now. Anuj Kumar has a short post that explains all this, primarily for Emacs and Vi but also for more general frameworks like X11 and the CUA.

If you’re already familiar with this lore, you probably won’t learn much new except for the names of some of the people who influenced the design in various ways. If you aren’t familiar with it, take a look at Kumar’s post. If you’re using Emacs or Vi(m), you really should know this stuff.

Posted in General | Tagged , | Leave a comment

Zettelkastens in 10 Minutes

Tomas Vik has a very nice post introducing the Zettelkasten concept. He says that rather than spending hours researching the Zettelkasten idea, you can just read his post and get a good introduction. I especially liked his section on the slip-box method.

The TL;DR for the slip-box method is:

  1. Make notes as you read: The most important point here is to write the notes in your own words. Doing that forces you to understand the material
  2. Write atomic, self-contained, concise, permanent notes
  3. Link the notes together
  4. Tag the notes: The important thing here is to use tags that capture the concept that you think you will want to retrieve the note by.

The other useful aspect to Vik’s post is his software recommendation. He says that the best bet for most people is Zettlr. It uses Markdown for recording notes and stores them in separate files. It’s open source and works on Linux, macOS, and Windows. If you’re not an Emacs user, Zettlr seems like a good solution.

If you are an Emacser, there’s Org-roam, which is getting very good reviews. As I said before, I’ve installed it but still haven’t found time to configure it or move my (very few) notes over to it. The nice things about the Zettelkasten idea is that you can implement it in many different ways, including the original method of writing the notes on index cards and storing them in a box. That’s where the term “slip-box” came from. Slip-box, in turn, is a translation of the original German term, “Zettelkasten.”

If you’re at all interested in Zettelkastens, Vik’s post is definitely worth your time.

Posted in General | Tagged , | Leave a comment

What Could Go Wrong?

Over at Six Colors, Jason Snell tells us that congress wants to tinker with the COVID-19 tracking framework set up by Apple and Google. Why not? What could go wrong? The same people who brought you the Government Healthcare Website, the botched and confused response to COVID-19, and, of course, the DMV want to try their hand at designing a secure, privacy protecting health tracking application. They seem sure that Apple and Google could use the help.

You don’t have to be a cynic or a fortune teller to predict that what this will mean in practice is that the privacy guarantees will be weakened in the name of getting more data. Local and federal health officials all want as much data as they can get so that they can more effectively track the spread of the virus. That’s a legitimate desire but it can’t come at the cost of a robust privacy guarantee.

I say that not as a privacy absolutist but as a pragmatist. Americans are famously curmudgeonly and suspicious of government intrusions into their business. As Snell points out, there’s a very real danger that privacy concerns will cause a significant number of Americans to opt out of participating in the program resulting in less data and probably rendering the program ineffective. As nice as it would be for various congressmen to see their names on legislation aimed at combating COVID-19 perhaps they could leave this one alone.

Posted in General | Tagged | Leave a comment

A Handwriting Font

Sacha Chua has perpetrated a truly wonderful hack. She’s built a font based on her handwriting. She’s using it for blog post titles and a few other places on her website, so take a look there to see what it looks like.

The reason I really like her project is because it’s such a great example of software engineering. Think for a moment how you would do it. You want to take examples of your printing and turn it into a font. I, for one, would have no idea where to start. I’d probably think of something like Knuth’s Metafont but it’s not clear how to proceed from there or even if it’s the right tool. Like me, Chua has no experience with typography but using open source tools she came up with a very nice looking font. It’s much more than throwing together a bunch of pictures of letters to make a monospace font—most of us could probably do that. Her result is a proportional font complete with kerning.

Another great thing about her project is she did it in a literal way by using Org mode and code blocks to write and document her code. You can see that code here. Of course, she also did a lot of hand tweaking to get things just right. Doubtless her artistic talents were a big help there.

Most of us probably don’t need a “handwriting font” but it’s a great hack and definitely worth talking a look at.

Posted in General | Tagged , | Leave a comment

Red Meat Friday: Atom and VSCode

I recently saw a tweet that has some things to say about Atom and VSCode that are sure to make certain heads explode. It’s red meat, it’s Friday so here’s today’s Red Meat Friday offering:

For the Emacsers among you, at least it provides proof that it’s never too late for someone to see the light and move to Emacs.

Posted in General | Tagged , | Leave a comment

Summarizing Class Notes

Matheus Augusto da Silva has an interesting video that details how he uses Emacs and Org-mode to write summaries of his class notes. After a class, he likes to write a half page summary of his notes. He finds that limiting the summary to half a page helps him to think about the important points and distill down the content. You may or may not like that approach but his workflow could be useful in other situations.

What’s nice is that there’s quite a bit of formatting of his PDF output but da Silva handles all that with a LaTeX include file and headers. The actual text is entered in an Org file and includes virtually no LaTeX other than some coloring macros.

Even if you no longer need to worry about organizing your study materials, da Silva’s workflow shows how it’s easy to produce richly formatted PDF output by entering plain text into an Org file. He doesn’t have a link to his include file but there is a link to his configuration that includes the skeletons that he uses for his Org file headers.

The video is 9 minutes and 55 seconds so you can probably watch it during a coffee break. As I said, I like the way he abstracts all the formatting to files so that he doesn’t need to think about it once his environment is set up.

Posted in General | Tagged , | Leave a comment

More on the Websockets Port Scanning

This is a short update to my Websockets: Why We Can’t Have Nice Things post. That post discussed a tactic used by several Web sites that uses Websockets to scan for open localhost ports. There was some speculation that this was in service of an attempt to determine if remote processes were running on the computer, a security risk. Whatever the original purpose, Steve Stagg discovered that it was possible to connect to these ports and recover possibly sensitive data.

Bleeping Computer has an update on the matter that among other things lists some or all of the sites using this tactic. Their article also sheds light on the reason for the port scanning. It turns out that—at least on the part of the major sites—it is a security measure. You can read their article for the details but the TL;DR is that they’re all running a script from Lexis Nexis’ Threat Matrix service that performs the port scanning.

I expect that the browser manufacturers will soon put an end to this—especially in light of Stagg’s revelations—and, in fact, it’s already possible to disable it in Firefox. In the mean time, I doubt that this is really anything to worry about. It’s more about the audacity of Web sites thinking they have the right to run any code they want on our machines. Just imagine their response if we uploaded code to their servers to help prevent the download of malware. This sort of thing really needs to be made illegal.

Posted in General | Tagged | Leave a comment