add articles from the previous website

This commit is contained in:
Jip J. Dekker 2023-07-07 15:55:03 +10:00
parent 7d1a8bc780
commit b2190ee8ba
No known key found for this signature in database
8 changed files with 249 additions and 288 deletions

View File

@ -9,13 +9,14 @@ export async function generateRssFeed() {
let articles = await getAllArticles()
let siteUrl = process.env.NEXT_PUBLIC_SITE_URL
let author = {
name: 'Spencer Sharp',
email: 'spencer@planetaria.tech',
name: 'Jip J. Dekker',
email: 'jip.dekker@monash.edu',
}
let feed = new Feed({
title: author.name,
description: 'Your blog description',
description:
'The collection of writing by Jip about optimization, programming language, and general computer science',
author,
id: siteUrl,
link: siteUrl,

View File

@ -0,0 +1,192 @@
import { ArticleLayout } from '@/components/ArticleLayout'
export const meta = {
author: 'Jip J. Dekker',
date: '2017-02-24',
title: 'Implementing custom DTrace instrumentation',
description:
'DTrace (and SystemTap) are often the “go to” when adding tracing in high performance environments such as for example operating systems. This note discusses adding instrumentation to your own application, so you can take advantage of these powerful tools.',
}
export default (props) => <ArticleLayout meta={meta} {...props} />
Last semester I had a chance to work with DTrace. In particular, I implemented
custom DTrace instrumentation in Encore and [Pony](http://www.ponylang.org/).
Encore is a new programming language which extends Pony. The language is being
developed at Uppsala University. In this blog I will explain why you want to use
DTrace, how we use it, and how to add it to your application.
## What is DTrace?
DTrace stands for **dynamic trace**. Have you even had to go through your code
and add print-statements to gather statistics or debug? That is exactly what
DTrace tries to avoid! When an application uses DTrace, it has **instrumentation
points**. These are the points where you would gather or print data. Each
instrumentation point can contain some arguments. This will be the data
available at this instrumentation point. A big advantage of these
instrumentation points is that you do not have to remove them. This is because
it is dynamic; when an instrumentation point is not in use, the program will
skip over it.
If you are on a Mac, then many of the programs you are using already have
instrumentation points. DTrace was part of the Solaris operating system and
adopted into most BSD versions. Normal users can use the instrumentation points
implemented in existing programs. Various guides to exploring these
instrumentation points already exist. If you are on a Mac, then you could take a
look
[here](http://www.mactech.com/articles/mactech/Vol.23/23.11/ExploringLeopardwithDTrace/index.html).
FreeBSD offers its own guide, which you will find
[here](https://wiki.freebsd.org/DTrace/Tutorial).
### Sidenote: Linux — SystemTap
_Because of licensing troubles, DTrace is not the standard in Linux operating
systems. There are DTrace versions available, but you'll have to install them
into the kernel. An alternative is at hand though: SystemTap. SystemTap works
like DTrace, but there are a few key differences. In general, you can use the
same instrumentation points, but not the same scripts. To read more about
SystemTap visit their [website](https://sourceware.org/systemtap/index.html)._
## Writing DTrace scripts
In more serious use cases one-line DTrace instructions won't be enough. DTrace
offers a simple scripting interface. Using a few statements you can extract the
information you need. Within DTrace scripts we refer to instrumentation points
as **probes**. Every script contains statements in the following form:
```
probe description
/ predicate /
{
action statements
}
```
The probe descriptor is the defined name for the probe. The action statements
contain the actions executed when a probe activates. Finally, a predicate
describes a condition that has to hold for the actions to take place.
It is sometimes hard to find DTrace documentation. The [Dynamic Tracing
Guide](http://dtrace.org/guide/preface.html) is usually a great place to start.
It contains information on almost anything you might come across while writing
scripts. The documentation on the various types can be very helpful. Although
the guide refers to the Illumos operating system, it is the same on other
systems.
Although the statements are simple, they can gather important information. Take
for example the following
[script](https://github.com/ponylang/ponyc/blob/master/examples/dtrace/gc.d):
```
pony$target:::gc-start
{
@count["GC Passes"] = count();
self->start_gc = timestamp;
}
pony$target:::gc-end
{
@quant["Time in GC (ns)"] = quantize(timestamp - self->start_gc);
@times["Total time"] = sum(timestamp - self->start_gc);
}
END
{
printa(@count);
printa(@quant);
printa(@times);
}
```
This script analyses the garbage collection in the Pony runtime. It will show
you how many times garbage collection ran, how much time it took, and how the
time was distributed. This is very important information when analysing the
performance of the garbage collector. The following image shows the output of an
example run of the DTrace script:
```
GC Passes 7
Time in GC (ns)
value ---------- Distribution ---------- count
1024 | 0
2048 |@@@@@@@@@@@ 2
4096 |@@@@@@@@@@@ 2
8192 |@@@@@@@@@@@ 2
16384 |@@@@@@ 1
32768 | 0
Total time 56721
```
DTrace script are usually saved with a `.d` file type. To run a DTrace script
you use `dtrace -s [script].d`. If you want to limit the results to an
executable, then you can add `-c [executable]`. This executable will then be
start with the script running.
### Tip: Shebang
_If you include `#!/usr/bin/env dtrace -s` on the first line in your file, then
you don't have to type `dtrace -s` every time. If your script is executable,
then you can run `./[script].d`. You can append any DTrace flags you deem
necessary._
## Adding your own probes
If you are writing a program in C, you have the option of adding your own
probes. The process is simple:
1. You define your probes.
2. You generate C macros for the probes.
3. You place the macros within the C code.
Take a look at [this
guide](https://www.ibm.com/developerworks/aix/library/au-dtraceprobes.html) for
an in-detail walkthrough. It will show you the syntax for defining your own
probes and how to compile your code. Note that there are differences in the
compilation process for DTrace and SystemTap. Take these into account in your
Makefile.
The names of the macros that DTrace generates leave something to be desired.
Their worst quality is that they can be ambiguous. For example, the probe
`gc-start`, in Pony, will generate the macro `PONY_GC_START`. This name suggests
that the macro would start the garbage collection. In a large code base the
macros can also be hard to find. To improve on this, you can add a macro
framework. Pony has its macro framework
[here](https://github.com/ponylang/ponyc/blob/master/src/common/dtrace.h). This
will let you call the macro like this: `DTRACE1(GC_START, ...);`.
### Sidenote: macOS — System Integrity Protection
_In newer versions of macOS not all features of DTrace are available to all
users. **System Integrity Protection** blocks some features. This includes the
use of custom probes. To use them, you need to partially disable System
Integrity Protection. [This
blog](http://internals.exposed/blog/dtrace-vs-sip.html) describes the problem
and how to solve it._
## A glimpse of Pony
It might be helpful to take a look at a working implementation. Encore is
currently not open source, but Pony is! You can find the Pony repository
[here](https://github.com/ponylang/ponyc). The following items you might find
useful:
- [The probe definitions](https://github.com/ponylang/ponyc/blob/master/src/common/dtrace_probes.d)
- [The macro framework](https://github.com/ponylang/ponyc/blob/master/src/common/dtrace.h)
- [The documentation and example scripts](https://github.com/ponylang/ponyc/tree/master/examples/dtrace)
You can find the use of the probes in the C code by searching for `DTRACE` in
any `.c` file.
## Resources
- [Exploring Leopard with DTrace](http://www.mactech.com/articles/mactech/Vol.23/23.11/ExploringLeopardwithDTrace/index.html)
- [The DTrace One-Liner Tutorial](https://wiki.freebsd.org/DTrace/Tutorial)
- [SystemTap](https://sourceware.org/systemtap/index.html)
- [Dynamic Tracing Guide](http://dtrace.org/guide/preface.html)
- [Adding DTrace probes to your applications](http://www.ibm.com/developerworks/aix/library/au-dtraceprobes.html)
- [DTrace vs. System Integrity Protection](http://internals.exposed/blog/dtrace-vs-sip.html)
- [The Pony Repository](https://github.com/ponylang/ponyc)

View File

@ -0,0 +1,51 @@
import { ArticleLayout } from '@/components/ArticleLayout'
export const meta = {
author: 'Jip J. Dekker',
date: '2022-08-15',
title: 'A Homebrew Tap for MiniZinc Solvers',
description:
"I'm proposing a Homebrew tap to make it easier for users to install different MiniZinc solvers. The tap already contains many of the open source solvers that are current contenders in the MiniZinc challenge, and I'm hoping to add any others that fit the infrastructure.",
}
export default (props) => <ArticleLayout meta={meta} {...props} />
TLDR; I'm proposing a [Homebrew](https://brew.sh/) tap to make it easier for users to install different MiniZinc solvers.
The tap already contains many of the open source solvers that are current contenders in the MiniZinc challenge, and I'm hoping to add any others that fit the infrastructure.
I will try to keep the solvers contained in the tap up-to-date, but contributions are always welcome.
The tap can be found in this [GitHub repository](https://github.com/Dekker1/homebrew-minizinc).
---
One of the strengths of the MiniZinc ecosystem is the great variety of solvers that have support for the language, each with their different strengths and weaknesses.
Using different solvers to solve your MiniZinc solvers has improved a lot over the years (at least in my opinion).
The process now generally consists of installing the right prerequisites, the solver itself, and putting all the MiniZinc files (the library and the solver configuration) in the right place.
That being said, this can still be a bit of work (or at least something that is easy to do wrong).
Luckily this problem is the exact problem that package manages already solve.
Although I cannot offer a solution for all devices (let's refrain from having yet another package manager), devices using [Homebrew](https://brew.sh/) can now use my [MiniZinc solver tap](https://github.com/Dekker1/homebrew-minizinc).
If you have Homebrew installed, then using the tap to, for example, install Yuck is as simple as running `brew install dekker1/minizinc/yuck`.
Once the process is finished “Yuck 20210501” can be immediately used from the MiniZincIDE, or from command line running `minizinc --solver yuck <file.mzn>`.
The tap can currently help to install the following solvers:
- [Choco](https://choco-solver.org) — `brew install dekker1/minizinc/choco`
- [Chuffed](https://github.com/chuffed/chuffed) — `brew install dekker1/minizinc/chuffed`
- [flatzingo](https://github.com/potassco/flatzingo) — `brew install dekker1/minizinc/flatzingo`
- [FindMUS](https://gitlab.com/minizinc/FindMUS) — `brew install dekker1/minizinc/findmus`
- [Geas](https://bitbucket.org/gkgange/geas) — `brew install dekker1/minizinc/geas`
- [JaCoP](https://github.com/radsz/jacop/) — `brew install dekker1/minizinc/jacop`
- [FZN Picat](https://github.com/nfzhou/fzn_picat) — `brew install dekker1/minizinc/fzn-picat`
- Note: this tap contains only the FlatZinc interface to [Picat](http://picat-lang.org), it depends on the Picat package in Hombebrew core.
- [Yuck](https://github.com/informarte/yuck/) — `brew install dekker1/minizinc/yuck`
_A continuously updated list of the solvers included can be found in the [repository README](https://github.com/Dekker1/homebrew-minizinc)._
It is my intention to keep at least these solvers up-to-date, and I will try to add other open source MiniZinc challenge contenders.
Contributions to update solvers or add new solvers are very welcome.
Finally, I understand that Homebrew might not work for everyone.
It is limited in its supported operating systems, and some people seem to really despise it.
If you prefer some other package manager or in the future there is a better/more inclusive alternative, then hopefully this Homebrew tap can serve as inspiration.
If you have any problems, then feel free to file an [issue](https://github.com/Dekker1/homebrew-minizinc/issues).

View File

@ -1,86 +0,0 @@
import { ArticleLayout } from '@/components/ArticleLayout'
import Image from 'next/image'
import designSystem from './planetaria-design-system.png'
export const meta = {
author: 'Adam Wathan',
date: '2022-09-05',
title: 'Crafting a design system for a multiplanetary future',
description:
'Most companies try to stay ahead of the curve when it comes to visual design, but for Planetaria we needed to create a brand that would still inspire us 100 years from now when humanity has spread across our entire solar system.',
}
export default (props) => <ArticleLayout meta={meta} {...props} />
Most companies try to stay ahead of the curve when it comes to visual design, but for Planetaria we needed to create a brand that would still inspire us 100 years from now when humanity has spread across our entire solar system.
<Image src={designSystem} alt="" />
I knew that to get it right I was going to have to replicate the viewing conditions of someone from the future, so I grabbed my space helmet from the closet, created a new Figma document, and got to work.
## Sermone fata
Lorem markdownum, bracchia in redibam! Terque unda puppi nec, linguae posterior
in utraque respicere candidus Mimasque formae; quae conantem cervice. Parcite
variatus, redolentia adeunt. Tyrioque dies, naufraga sua adit partibus celanda
torquere temptata, erit maneat et ramos, [iam](#) ait dominari
potitus! Tibi litora matremque fumantia condi radicibus opusque.
Deus feram verumque, fecit, ira tamen, terras per alienae victum. Mutantur
levitate quas ubi arcum ripas oculos abest. Adest [commissaque
victae](#) in gemitus nectareis ire diva
dotibus ora, et findi huic invenit; fatis? Fractaque dare superinposita
nimiumque simulatoremque sanguine, at voce aestibus diu! Quid veterum hausit tu
nil utinam paternos ima, commentaque.
```c
exbibyte_wins = gigahertz(3);
grayscaleUtilityClient = control_uat;
pcmciaHibernate = oop_virus_console(text_mountain);
if (stateWaisFirewire >= -2) {
jfs = 647065 / ldapVrml(tutorialRestore, 85);
metal_runtime_parse = roomComputingResolution - toolbarUpload +
ipx_nvram_open;
} else {
maximizeSidebar *= suffix_url(flatbed + 2, requirements_encoding_node +
only_qbe_media, minicomputer);
}
```
Aere repetiti cognataque natus. Habebat vela solutis saepe munus nondum adhuc
oscula nomina pignora corpus deserat.
## Lethaei Pindumve me quae dinumerat Pavor
Idem se saxa fata pollentibus geminos; quos pedibus. Est urnis Herses omnes nec
divite: et ille illa furit sim verbis Cyllenius.
1. Captus inpleverunt collo
2. Nec nam placebant
3. Siquos vulgus
4. Dictis carissime fugae
5. A tacitos nulla viginti
Ungues fistula annoso, ille addit linoque motatque uberior verso
[rubuerunt](#) confine desuetaque. _Sanguine_ anteit
emerguntque expugnacior est pennas iniqui ecce **haeret** genus: peiora imagine
fossas Cephisos formosa! Refugitque amata [refelli](#)
supplex. Summa brevis vetuere tenebas, hostes vetantis, suppressit, arreptum
regna. Postquam conpescit iuvenis habet corpus, et erratica, perdere, tot mota
ars talis.
```c
digital.webcam_dual_frequency = webmasterMms;
if (5 + language_standalone_google) {
cc_inbox_layout *= file_character;
task += p;
lockUnicode += enterprise_monochrome(tokenFunctionPersonal, keyVirtual,
adf);
}
windows_binary_esports(87734, array(restoreRomTopology, adRaw(407314),
dongleBashThumbnail), interpreter);
```
Sit volat naturam; motu Cancri. Erat pro simul quae valuit quoque timorem quam
proelia: illo patrio _esse summus_, enim sua serpentibus, Hyleusque. Est coniuge
recuso; refert Coroniden ignotos manat, adfectu.

View File

@ -38,14 +38,14 @@ export default function ArticlesIndex({ articles }) {
return (
<>
<Head>
<title>Articles - Spencer Sharp</title>
<title>Articles - Jip J. Dekker</title>
<meta
name="description"
content="All of my long-form thoughts on programming, leadership, product design, and more, collected in chronological order."
/>
</Head>
<SimpleLayout
title="Writing on software design, company building, and the aerospace industry."
title="Writing on optimization, programming languages."
intro="All of my long-form thoughts on programming, leadership, product design, and more, collected in chronological order."
>
<div className="md:border-l md:border-zinc-100 md:pl-6 md:dark:border-zinc-700/40">

View File

@ -1,101 +0,0 @@
import { ArticleLayout } from '@/components/ArticleLayout'
export const meta = {
author: 'Adam Wathan',
date: '2022-09-02',
title: 'Introducing Animaginary: High performance web animations',
description:
'When youre building a website for a company as ambitious as Planetaria, you need to make an impression. I wanted people to visit our website and see animations that looked more realistic than reality itself.',
}
export default (props) => <ArticleLayout meta={meta} {...props} />
When youre building a website for a company as ambitious as Planetaria, you need to make an impression. I wanted people to visit our website and see animations that looked more realistic than reality itself.
To make this possible, we needed to squeeze every drop of performance out of the browser possible. And so Animaginary was born.
```js
import { animate } from '@planetaria/animaginary'
export function MyComponent({ open, children }) {
return (
<animate.div
in={open}
animateFrom="opacity-0 scale-95"
animateTo="opacity-100 scale-100"
duration={350}
>
{children}
</animate.div>
)
}
```
Animaginary is our new web animation library that redefines what you thought was possible on the web. Hand-written in optimized WASM, Animaginary can even animate the `height` property of an element at 60fps.
## Sermone fata
Lorem markdownum, bracchia in redibam! Terque unda puppi nec, linguae posterior
in utraque respicere candidus Mimasque formae; quae conantem cervice. Parcite
variatus, redolentia adeunt. Tyrioque dies, naufraga sua adit partibus celanda
torquere temptata, erit maneat et ramos, [iam](#) ait dominari
potitus! Tibi litora matremque fumantia condi radicibus opusque.
Deus feram verumque, fecit, ira tamen, terras per alienae victum. Mutantur
levitate quas ubi arcum ripas oculos abest. Adest [commissaque
victae](#) in gemitus nectareis ire diva
dotibus ora, et findi huic invenit; fatis? Fractaque dare superinposita
nimiumque simulatoremque sanguine, at voce aestibus diu! Quid veterum hausit tu
nil utinam paternos ima, commentaque.
```c
exbibyte_wins = gigahertz(3);
grayscaleUtilityClient = control_uat;
pcmciaHibernate = oop_virus_console(text_mountain);
if (stateWaisFirewire >= -2) {
jfs = 647065 / ldapVrml(tutorialRestore, 85);
metal_runtime_parse = roomComputingResolution - toolbarUpload +
ipx_nvram_open;
} else {
maximizeSidebar *= suffix_url(flatbed + 2, requirements_encoding_node +
only_qbe_media, minicomputer);
}
```
Aere repetiti cognataque natus. Habebat vela solutis saepe munus nondum adhuc
oscula nomina pignora corpus deserat.
## Lethaei Pindumve me quae dinumerat Pavor
Idem se saxa fata pollentibus geminos; quos pedibus. Est urnis Herses omnes nec
divite: et ille illa furit sim verbis Cyllenius.
1. Captus inpleverunt collo
2. Nec nam placebant
3. Siquos vulgus
4. Dictis carissime fugae
5. A tacitos nulla viginti
Ungues fistula annoso, ille addit linoque motatque uberior verso
[rubuerunt](#) confine desuetaque. _Sanguine_ anteit
emerguntque expugnacior est pennas iniqui ecce **haeret** genus: peiora imagine
fossas Cephisos formosa! Refugitque amata [refelli](#)
supplex. Summa brevis vetuere tenebas, hostes vetantis, suppressit, arreptum
regna. Postquam conpescit iuvenis habet corpus, et erratica, perdere, tot mota
ars talis.
```c
digital.webcam_dual_frequency = webmasterMms;
if (5 + language_standalone_google) {
cc_inbox_layout *= file_character;
task += p;
lockUnicode += enterprise_monochrome(tokenFunctionPersonal, keyVirtual,
adf);
}
windows_binary_esports(87734, array(restoreRomTopology, adRaw(407314),
dongleBashThumbnail), interpreter);
```
Sit volat naturam; motu Cancri. Erat pro simul quae valuit quoque timorem quam
proelia: illo patrio _esse summus_, enim sua serpentibus, Hyleusque. Est coniuge
recuso; refert Coroniden ignotos manat, adfectu.

View File

@ -1,96 +0,0 @@
import { ArticleLayout } from '@/components/ArticleLayout'
export const meta = {
author: 'Adam Wathan',
date: '2022-07-14',
title: 'Rewriting the cosmOS kernel in Rust',
description:
'When we released the first version of cosmOS last year, it was written in Go. Go is a wonderful programming language, but its been a while since Ive seen an article on the front page of Hacker News about rewriting some important tool in Go and I see articles on there about rewriting things in Rust every single week.',
}
export default (props) => <ArticleLayout meta={meta} {...props} />
When we released the first version of cosmOS last year, it was written in Go. Go is a wonderful programming language with a lot of benefits, but its been a while since Ive seen an article on the front page of Hacker News about rewriting some important tool in Go and I see articles on there about rewriting things in Rust every single week.
```rust
use ferris_says::say;
use std::io::{stdout, BufWriter};
fn main() {
let stdout = stdout();
let message = String::from("Hello fellow hackers");
let width = message.chars().count();
let mut writer = BufWriter::new(stdout.lock());
say(message.as_bytes(), width, &mut writer).unwrap();
}
```
I derive a large amount of my self-worth from whether or not Hacker News is impressed with the work I'm doing, so when I realized this, I cancelled all of our existing projects and started migrating everything to Rust immediately.
## Sermone fata
Lorem markdownum, bracchia in redibam! Terque unda puppi nec, linguae posterior
in utraque respicere candidus Mimasque formae; quae conantem cervice. Parcite
variatus, redolentia adeunt. Tyrioque dies, naufraga sua adit partibus celanda
torquere temptata, erit maneat et ramos, [iam](#) ait dominari
potitus! Tibi litora matremque fumantia condi radicibus opusque.
Deus feram verumque, fecit, ira tamen, terras per alienae victum. Mutantur
levitate quas ubi arcum ripas oculos abest. Adest [commissaque
victae](#) in gemitus nectareis ire diva
dotibus ora, et findi huic invenit; fatis? Fractaque dare superinposita
nimiumque simulatoremque sanguine, at voce aestibus diu! Quid veterum hausit tu
nil utinam paternos ima, commentaque.
```c
exbibyte_wins = gigahertz(3);
grayscaleUtilityClient = control_uat;
pcmciaHibernate = oop_virus_console(text_mountain);
if (stateWaisFirewire >= -2) {
jfs = 647065 / ldapVrml(tutorialRestore, 85);
metal_runtime_parse = roomComputingResolution - toolbarUpload +
ipx_nvram_open;
} else {
maximizeSidebar *= suffix_url(flatbed + 2, requirements_encoding_node +
only_qbe_media, minicomputer);
}
```
Aere repetiti cognataque natus. Habebat vela solutis saepe munus nondum adhuc
oscula nomina pignora corpus deserat.
## Lethaei Pindumve me quae dinumerat Pavor
Idem se saxa fata pollentibus geminos; quos pedibus. Est urnis Herses omnes nec
divite: et ille illa furit sim verbis Cyllenius.
1. Captus inpleverunt collo
2. Nec nam placebant
3. Siquos vulgus
4. Dictis carissime fugae
5. A tacitos nulla viginti
Ungues fistula annoso, ille addit linoque motatque uberior verso
[rubuerunt](#) confine desuetaque. _Sanguine_ anteit
emerguntque expugnacior est pennas iniqui ecce **haeret** genus: peiora imagine
fossas Cephisos formosa! Refugitque amata [refelli](#)
supplex. Summa brevis vetuere tenebas, hostes vetantis, suppressit, arreptum
regna. Postquam conpescit iuvenis habet corpus, et erratica, perdere, tot mota
ars talis.
```c
digital.webcam_dual_frequency = webmasterMms;
if (5 + language_standalone_google) {
cc_inbox_layout *= file_character;
task += p;
lockUnicode += enterprise_monochrome(tokenFunctionPersonal, keyVirtual,
adf);
}
windows_binary_esports(87734, array(restoreRomTopology, adRaw(407314),
dongleBashThumbnail), interpreter);
```
Sit volat naturam; motu Cancri. Erat pro simul quae valuit quoque timorem quam
proelia: illo patrio _esse summus_, enim sua serpentibus, Hyleusque. Est coniuge
recuso; refert Coroniden ignotos manat, adfectu.