Skip to content

Commit

Permalink
chore(latex): use textsc instead of sc for compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
Roman Kashitsyn authored and Roman Kashitsyn committed Jun 2, 2024
1 parent 7c4884c commit dc7c0e2
Show file tree
Hide file tree
Showing 21 changed files with 152 additions and 152 deletions.
2 changes: 1 addition & 1 deletion blogware/symtab.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ var (
SymUnderline = BuiltinCmd("u", ArgTypeSeq)
SymNormal = BuiltinCmd("normal", ArgTypeSeq)
SymEmphasis = BuiltinCmd("emph", ArgTypeSeq)
SymSmallCaps = BuiltinCmd("sc", ArgTypeSeq)
SymSmallCaps = BuiltinCmd("textsc", ArgTypeSeq)
SymCircled = BuiltinCmd("circled", ArgTypeNum)
SymCode = BuiltinCmd("code", ArgTypeSeq)
SymCenter = BuiltinCmd("center", ArgTypeSeq)
Expand Down
6 changes: 3 additions & 3 deletions posts/01-effective-rust-canisters.tex
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,7 @@ \section{infra}{Infrastructure}
\subsection{builds}{Builds}

People using your canister might want to verify that it does what it claims to do (especially if the canister moves people's tokens around).
The Internet Computer allows anyone to inspect the \sc{sha256} hash sum of the canister WebAssembly module.
The Internet Computer allows anyone to inspect the \textsc{sha256} hash sum of the canister WebAssembly module.
However, there are no good tools yet to review the canister's source code.
The developer is responsibile for providing a reproducible way of building a WebAssembly module from the published source code.

Expand Down Expand Up @@ -830,7 +830,7 @@ \subsection{upgrades}{Upgrades}
\item
Changing the layout of your data might be infeasible.
It will simply be too much work for a canister to complete the data migration in one go.
Imagine writing a program that reformats an eight-gigabyte disk from \sc{fat32} to \sc{ntfs} without losing any data.
Imagine writing a program that reformats an eight-gigabyte disk from \textsc{fat32} to \textsc{ntfs} without losing any data.
By the way, that program must complete in under 5 seconds.
\item
You must think carefully about the backward compatibility of your data structures.
Expand All @@ -843,7 +843,7 @@ \subsection{upgrades}{Upgrades}
\subsection{observability}{Observability}


At \href{https://dfinity.org/}{\sc{dfinity}}, we use metrics extensively and monitor all our production services.
At \href{https://dfinity.org/}{\textsc{dfinity}}, we use metrics extensively and monitor all our production services.
Metrics are indispensable for understanding the behaviors of a complex distributed system.
Canisters are not unique in this regard.

Expand Down
2 changes: 1 addition & 1 deletion posts/03-rust-packages-crates-modules.tex
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ \section{code-organization-advice}{Advice on code organization}
Especially libraries should expose full flexibility to their users, and not use implicit logging behaviour.

Usually \code{Logger} instances fit pretty neatly into data structures in your code representing resources, so it's not that hard to pass them in constructors, and use \code{info!(self.log, ...)} everywhere.
}{\href{https://github.com/slog-rs/slog/wiki/FAQ#do-i-have-to-pass-logger-around}{\code{slog} \sc{faq}}}
}{\href{https://github.com/slog-rs/slog/wiki/FAQ#do-i-have-to-pass-logger-around}{\code{slog} \textsc{faq}}}

By passing state implicitly, you gain temporary convenience but make your code less clear, less testable, and more error-prone.
Every type of resource we passed implicitly\sidenote{sn-resource-types}{\href{https://crates.io/crates/slog-scope}{scoped} loggers, \href{https://crates.io/crates/prometheus}{Prometheus} metrics registries, \href{https://crates.io/crates/rayon}{Rayon} thread pools, \href{https://crates.io/crates/tokio}{Tokio} runtimes, to name a few.} caused hard-to-diagnose issues and wasted a lot of engineering time.
Expand Down
34 changes: 17 additions & 17 deletions posts/04-square-joy-trapped-rain-water.tex
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ \section{the-why}{But why?}
Idiomatic solutions require knowledge of many little tricks array-wrangling wizards developed in their chambers over the last fifty years.
I would love to learn or rediscover these tricks, and I hope you might derive some pleasure and insights from reading about my little discoveries.

In this article, we'll use the \href{https://www.jsoftware.com/#/}{\sc{j} programming language}.
Why \sc{j} and not, say, \href{https://dyalog.com/}{\sc{apl}}?
\sc{j} is easier to type on most keyboards, and it's \href{https://github.com/jsoftware/jsource}{open source}.
In this article, we'll use the \href{https://www.jsoftware.com/#/}{\textsc{j} programming language}.
Why \textsc{j} and not, say, \href{https://dyalog.com/}{\textsc{apl}}?
\textsc{j} is easier to type on most keyboards, and it's \href{https://github.com/jsoftware/jsource}{open source}.

The code in this article will look like line noise if you aren't familiar with \sc{j}.
Don't be discouraged; this reaction is typical when working with \sc{j}.
The code in this article will look like line noise if you aren't familiar with \textsc{j}.
Don't be discouraged; this reaction is typical when working with \textsc{j}.
I'll explain most of the steps, but the steps might still look like black magic sometimes.
My goal is not to explain every aspect of the language but to demonstrate the problem-solving approach.

Expand Down Expand Up @@ -79,9 +79,9 @@ \section{a-solution}{A solution}

\section{translating-to-j}{Translating our idea to J}

\sc{j} is an interpreted language and it has a \href{https://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop}{\sc{repl}}.
It's pretty standard for \sc{j} programmers to build solutions incrementally by trying snippets of code in the \sc{repl} and observing the effects.
The code in this article is also an interactive \sc{repl} session that you can replicate locally.
\textsc{j} is an interpreted language and it has a \href{https://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop}{\textsc{repl}}.
It's pretty standard for \textsc{j} programmers to build solutions incrementally by trying snippets of code in the \textsc{repl} and observing the effects.
The code in this article is also an interactive \textsc{repl} session that you can replicate locally.
Let us get some data to play with.

\begin{code}[j]
Expand All @@ -107,10 +107,10 @@ \section{translating-to-j}{Translating our idea to J}

Wait, where is all the code?
Let me break it down.
In \sc{j}, \href{https://code.jsoftware.com/wiki/Vocabulary/gtdot#dyadic}{\code{>.} (max)} is a verb (\sc{j} word for "function") that, when you use it dyadically (\sc{J} word for ``with two arguments''), computes the maximum of the arguments.
In \textsc{j}, \href{https://code.jsoftware.com/wiki/Vocabulary/gtdot#dyadic}{\code{>.} (max)} is a verb (\textsc{j} word for "function") that, when you use it dyadically (\textsc{J} word for ``with two arguments''), computes the maximum of the arguments.
It's easy to guess that \href{https://code.jsoftware.com/wiki/Vocabulary/ltdot#dyadic}{\code{<.} (min)} is an analogous verb that computes the minimum.

The single character \href{https://code.jsoftware.com/wiki/Vocabulary/slash}{\code{/} (insert)} is an adverb (\sc{j} word for ``function modifier'') that takes a dyadic verb to the left and turns it into a verb that folds an entire array.
The single character \href{https://code.jsoftware.com/wiki/Vocabulary/slash}{\code{/} (insert)} is an adverb (\textsc{j} word for ``function modifier'') that takes a dyadic verb to the left and turns it into a verb that folds an entire array.
Why is it called ``insert''?
Because it inserts the verb between elements of the array it operates on.
For example, summing up an array is just \code{+/}.
Expand Down Expand Up @@ -179,7 +179,7 @@ \section{translating-to-j}{Translating our idea to J}
6
\end{verbatim}

The full implementation of our idea now fits into 12 \sc{ascii} characters.
The full implementation of our idea now fits into 12 \textsc{ascii} characters.
One surprising property of array languages is that it's often not worth naming functions.
Their entire body is shorter and more expressive than any name we could come up with.

Expand Down Expand Up @@ -297,13 +297,13 @@ \section{drawing-solutions}{Drawing solutions}
█░██░██████
\end{verbatim}

\code{ucp} is a built-in verb that constructs an array of Unicode codepoints from a \sc{utf}-8 encoded string.
\code{ucp} is a built-in verb that constructs an array of Unicode codepoints from a \textsc{utf}-8 encoded string.
\href{https://code.jsoftware.com/wiki/Vocabulary/curlylf#dyadic}{\code{\{} (from)} is at the heart of our drawing trick.
This verb selects items from the right argument according to the indices from the left argument.
The effect is that all zeros got replaced with a space, ones---with a watery-looking glyph, and twos---with a solid rectangle.

Our pseudo-graphics look quite impressive already, but we can do even better.
\sc{j} comes with a convenient \href{https://code.jsoftware.com/wiki/Studio/Viewmat}{viewmat} library that can visualize arrays.
\textsc{j} comes with a convenient \href{https://code.jsoftware.com/wiki/Studio/Viewmat}{viewmat} library that can visualize arrays.

\begin{code}[j]
require 'viewmat'
Expand Down Expand Up @@ -410,7 +410,7 @@ \subsection{solution-3d}{Solution}
\item Iterate the previous step until the distance grid converges.
\end{itemize}

Let's put this idea in \sc{j} now.
Let's put this idea in \textsc{j} now.
We start by constructing the initial matrix of distances.
We'll use the \href{https://code.jsoftware.com/wiki/Vocabulary/dollar}{\code{\$} (shape of, reshape)} verb for that.

Expand Down Expand Up @@ -510,7 +510,7 @@ \subsection{solution-3d}{Solution}
step =. >. ((_1 & (|.!.0)) <. (1 & (|.!.0)) <. (_1 & (|.!.0)"1) <. (1 & (|.!.0)"1))
\end{verbatim}

To apply this function iteratively, we'll use the \href{https://code.jsoftware.com/wiki/Vocabulary/hatco}{\code{^:} (power of verb)} conjunction (another \sc{j} word for ``verb modifier'').
To apply this function iteratively, we'll use the \href{https://code.jsoftware.com/wiki/Vocabulary/hatco}{\code{^:} (power of verb)} conjunction (another \textsc{j} word for ``verb modifier'').
If we raise a verb to power \math{N}, we get a verb that applies the original verb \math{N} times in a row.
If we raise a verb to infinite power \href{https://code.jsoftware.com/wiki/Vocabulary/under}{\code{_} (infinity)}, the original verb gets applied until the computation reaches a fixed point.

Expand Down Expand Up @@ -636,13 +636,13 @@ \section{back-to-2d}{Looking back at Flatland}
\end{figure}

\section{where-to-go-next}{Where to go next}
That was all the \sc{j} magic for today!
That was all the \textsc{j} magic for today!
If you are confused and intrigued, I can recommend the following resources:

\begin{itemize}
\item Solve this problem on \href{https://leetcode.com/problems/trapping-rain-water/}{Leetcode}.
\item Watch \href{https://youtu.be/ftcIcn8AmSY}{Four Solutions to a Trivial Problem}, a talk by Guy Steele where he explores the problem from different angles.
\item Read some \href{https://code.jsoftware.com/wiki/Books}{Books on \sc{j}}.
\item Read some \href{https://code.jsoftware.com/wiki/Books}{Books on \textsc{j}}.
\item Listen to the \href{https://arraycast.com/}{Arraycast podcast}.
\end{itemize}
\end{document}
Expand Down
20 changes: 10 additions & 10 deletions posts/05-debug-like-feynman.tex
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,10 @@ \section{know-your-data}{Know your data}
About 40 seconds after the explosion the air blast reached me.
I tried to estimate its strength by dropping from about six feet small pieces of paper before, during and after the passage of the blast wave.
Since at the time, there was no wind I could observe very distinctly and actually measure the displacement of the pieces of paper that were in the process of falling while the blast was passing.
The shift was about 2½ meters, which, at the time, I estimated to correspond to the blast that would be produced by ten thousand tons of \sc{t.n.t.}
The shift was about 2½ meters, which, at the time, I estimated to correspond to the blast that would be produced by ten thousand tons of \textsc{t.n.t.}
}{Enrico Fermi, \href{https://www.atomicarchive.com/resources/documents/trinity/fermi.html}{My Observations During the Explosion at Trinity on July 16, 1945}}

A guy from the \sc{ops} team stops by your desk.
A guy from the \textsc{ops} team stops by your desk.
You feel uncomfortable because you forgot his name again.

``Hi! I need to buy machines for that new project you are working on.
Expand Down Expand Up @@ -182,7 +182,7 @@ \section{know-your-data}{Know your data}
The \href{https://carlos.bueno.org/optimization/}{Mature Optimization Handbook} will help you to get started.

Having all these data at your disposal will enable you to perform \href{https://en.wikipedia.org/wiki/Back-of-the-envelope_calculation}{back-of-envelope calculations}, of which Enrico Fermi was an absolute master.
Next time that \sc{ops} guy\sidenote{sn-josh}{Josh. His name is Josh.} comes to your desk, you will have an answer for him.
Next time that \textsc{ops} guy\sidenote{sn-josh}{Josh. His name is Josh.} comes to your desk, you will have an answer for him.

\section{debug-mental-models}{Debug mental models}

Expand Down Expand Up @@ -287,20 +287,20 @@ \section{formalize-your-models}{Formalize your models}

But it gets better.
Once you have a formal specification, you can feed it to a computer and start asking interesting questions.
\href{https://lamport.azurewebsites.net/video/videos.html}{\sc{tla}+} is a powerful and accessible toolbox that can help you write and check formal specifications.
\href{https://lamport.azurewebsites.net/video/videos.html}{\textsc{tla}+} is a powerful and accessible toolbox that can help you write and check formal specifications.
This is the system that the Amazon Web Services team used to build their critical systems (see \href{https://lamport.azurewebsites.net/tla/formal-methods-amazon.pdf}{How Amazon Web Services Uses Formal Methods}, Communications of the ACM, Vol. 58 No. 4, Pages 66-73).

\href{https://www.linkedin.com/in/chenghuang/}{Cheng Huang}, a principle engineering manager at Microsoft, \href{https://lamport.azurewebsites.net/tla/industrial-use.html}{wrote}:
\blockquote{
\sc{tla}+ uncovered a safety violation even in our most confident implementation.
\textsc{tla}+ uncovered a safety violation even in our most confident implementation.
We had a lock-free data structure implementation which was carefully design \& implemented, went through thorough code review, and was tested under stress for many days.
As a result, we had high confidence about the implementation.
We eventually decided to write a \sc{tla}+ spec, not to verify correctness, but to allow team members to learn and practice PlusCal.
We eventually decided to write a \textsc{tla}+ spec, not to verify correctness, but to allow team members to learn and practice PlusCal.
So, when the model checker reported a safety violation, it really caught us by surprise.
This experience has become the aha moment for many team members and their de facto testimonial about \sc{tla}+.
}{Leslie Lamport, \href{https://lamport.azurewebsites.net/tla/industrial-use.html}{Industrial Use of \sc{tla}+}}
This experience has become the aha moment for many team members and their de facto testimonial about \textsc{tla}+.
}{Leslie Lamport, \href{https://lamport.azurewebsites.net/tla/industrial-use.html}{Industrial Use of \textsc{tla}+}}

I wish I have learned about \sc{tla}+ much earlier in my career.
I wish I have learned about \textsc{tla}+ much earlier in my career.
Unlike other formal methods I tried, this tool is easy to pick up.

\section{question-method}{Question your method}
Expand All @@ -324,7 +324,7 @@ \section{question-method}{Question your method}
How many pictures have computers on them?

The amount of material on software development methodology is overwhelming.
\href{https://agilemanifesto.org/}{Agile}, \href{https://en.wikipedia.org/wiki/Extreme_programming}{\sc{xp}}, \href{https://scrum.org}{Scrum}, \href{https://en.wikipedia.org/wiki/Kanban_(development)}{Kanban}, \href{https://www.lean.org/}{Lean}, \href{https://en.wikipedia.org/wiki/Test-driven_development}{\sc{tdd}}, \href{https://en.wikipedia.org/wiki/Behavior-driven_development}{\sc{bdd}}, and the list goes on.
\href{https://agilemanifesto.org/}{Agile}, \href{https://en.wikipedia.org/wiki/Extreme_programming}{\textsc{xp}}, \href{https://scrum.org}{Scrum}, \href{https://en.wikipedia.org/wiki/Kanban_(development)}{Kanban}, \href{https://www.lean.org/}{Lean}, \href{https://en.wikipedia.org/wiki/Test-driven_development}{\textsc{tdd}}, \href{https://en.wikipedia.org/wiki/Behavior-driven_development}{\textsc{bdd}}, and the list goes on.
It is easy to get the impression that everyone knows the best way to develop software but you.
This impression is false.
No one has a clue.
Expand Down
Loading

0 comments on commit dc7c0e2

Please sign in to comment.