Archive | minor aside RSS for this section

amazon.com.au — hahahahahahahahah

Here is a book searched up on the .au site:

Mathematics into type on amazon Australia — price, $374

And on the US site:

And in the US — $22

OK, postage will be more from the US. But $350? I don’t think so.

In the end I bought a copy from discoverbooks.

Amazon, indeed.

Black screen with mouse after Windows login

Note to self

  1. Booted Win 10 machine.
  2. Got usual login screen.
  3. Logged in as per usual.
  4. Got a black screen with a working, visible mouse pointer.
  5. Ctrl-Alt-Del.
  6. Got the menu and chose Task Manager.
  7. Went to start up items and disabled most items, but enabled ‘Lenovo Utility’.
  8. Used Ctrl-Alt-Del to reboot.
  9. Got the screen back.

Of course, I’ve skipped all the messing around that I really did.

I don’t know why. Other non-admin account on the machine worked fine, so something funny happened in a setting somewhere. Anyway, there you go.

Win 10

tilde — my crude automated webpage

The whole world of ’tilde’ accounts is to give you a little server space where you can monkey around in bash and maybe build a website the 1990s way — by editing HTML in nano, emacs or vim.

Mine is here: https://tilde.club/~mz721/, and this is how it looked as-provided by the admin:

A brand new tilde club page

As provided

I have set it up so that if I scp files into the right directory, they will be automatically added to the index.html.

Consider the following bash script. I log into my account and run it from ~/public_html using nohup so that it does not stop when I log out. The makelinks.sh script lives in the ~/public_html/pages directory and just creates a block of HTML with links to each of the HTML files it finds in there.

The script then creates a little file with the time and date updated information in it, then cats all the bits together, then sleeps for a day and runs again. My scripting is very crude, but seems to work.

while true
do
  cd pages
  ./makelinks.sh
  cd  ..
  echo \<p\> \</p\> > date
  echo \<p\> \</p\> >> date
  echo Last updated: `date` >> date
  cat index.top.html pages/index.middle.html date index.tail.html > index.html
  rm date
  sleep 24h
done

Here is the text of makelinks.sh. It loops over all the .html files in the directory. The echo command prints out a line of the form of a basic HTML link. It grabs the second line of the html file for use as the link text (that is what the head/tail bit does) then creates the link.

rm index.middle.html
for f in *.html
do
	echo \<p\>\<a href=\"pages/$f\"\>$(head -2 $f | tail -1)\</a\>\</p\> >> index.middle.html
done

The output of makelinks.sh looks something like

$ cat pages/index.middle.html 
<p><a href="pages/hermes10.html">The Hermes 10 electric typewriter</a></p>

So all I have to do is make sure I upload a HTML file (with its dependencies) that looks something like the one below. Top 3 lines are:

  1. open comment
  2. link text
  3. close comment.

After that, any legit HTML should do.

<!--
Link text - always here.
-->
<html><head>
<title>Title</title>
</head>
<center>
  <h1>Main heading</h1>
</center>

Content

</body></html>

So I make up my new page locally, with the correct 3-line header, then scp it to the correct folder, and the script wakes up once a day and adds the page to the index.

Crude, but effective. Obviously, I can complexify what I do and add more features, but I’ll let that evolve with time.

 

Tildr?

Simple surface plot in gnuplot

Here’s a random example for no good reason.

Here is the gnuplot script (surfaceplot.gp):

set iso 30
set samp 50
unset key
#set title "sin(r)"
set xlabel "x" font "Times:Italic,14"
set ylabel "y" font "Times:Italic,14"
set zlabel "z" font "Times:Italic,14"
set xrange [-4:4]
set yrange [-4:4]
set xtics offset -0.5,-0.5
set ztics 1
unset surf
set style line 1 lt 4 lw 0.5
set pm3d
set term post level1 color font "Times,12" fontscale 1.0
set output "plotfile.eps"
splot sin(sqrt(x**2+y**2))

Here are the commands run at the command line:

$ gnuplot surfaceplot.gp 
$ epspdf plotfile.eps
$ xpdf plotfile.pdf
$ pdftoppm.exe -r 600 plotfile.pdf > plotfile.ppm
$ convert plotfile.ppm plotfile.png
$ display plotfile.png
$ rm plotfile.ppm

And this gives me an eps, a pdf and a png:

89K  plotfile.eps
56K  plotfile.pdf
990K plotfile.png
A coloured surface plot drawn in gnuplot using the script above

Yep

And here’s a simple script to plot sections through the surface:

$ cat cuts.gp 
unset key
#set title "sin(r)"
set xlabel "x" font "Times:Italic,18"
set ylabel "z" font "Times:Italic,18"
set xrange [-4:4]
set yrange [-1:1]
set border lw 0.25
#set style line 1 lt 4 lw 0.5
set term post level1 color font "Times,12" fontscale 1.0
set output "plotfile-cut-y=0.eps"
plot sin(sqrt(x**2+0**2)) lc rgb 'black' lw 4
set output "plotfile-cut-y=1.eps"
plot sin(sqrt(x**2+1**2)) lc rgb 'black' lw 4

And here is plotfile-cut-y=1

A section through the surface, where y=1; looks a bit like a capital M

Section where y=1

 ;ouihgvanieiogywev9np

Making a little icon for the webpage

You know those icons you get in the tabs when you view a webpage? They are really easy to do.

This is how I did one for my tilde.club page.

First, I found an image I wanted (from something related to this). It was in a PDF I had made some time ago, so I converted the PDF to a raster format, then cut out the bit wanted.

$ pdftoppm -f 1 -l 1 -r 600 mzfntdoc.pdf > icn.ppm
$ pnmcut 2935 2600 138 80 icn.ppm > cut.pnm

Convert to ico and png

$ convert cut.ppm cut.png
$ convert cut.ppm cut.ico

Copy to the filespace on the account.

$ scp cut.png username@tilde.club:public_html

Add a single line to the index.html — in the <head> … </head> field.

<head>
	<title>Random pages</title>
	<link rel="icon" href="cut.png">
</head>

That’s it. Here is the icon:

M Z in blocky text

The icon

And here it is in action — the webpage viewed in Firefox shows the icon in the tab.

The icon appears on the tab in Firefox

There it is!

That was easy!

Some random BibTeX bibliography style examples

Here we have some basic BibTeX bibliography styles, with a few of the key distinguishing features pointed out.

First, good old unsrt.bst

an unsorted bibliography style

Then, chicago (from natbib)

chicago manual of style

The Harvard-ish agsm style

the agsm style, derived from Harvard -- author -- year

And, last, an APA-based style (apalike, from natbib)

another author/year style

 

Well howdy

Removing horizontal lines in Word

Soooo….. I typed a bunch of hyphens then hit Enter, and Word drew me a line. Fine, I wanted that. It separated what was done from what was ‘in process’. Now I want to get rid of the line.

Highlight and delete — no.

Highlight and use the border menu to choose none — no! I tried this suggestion, but without success.

I could move the line up and down, but I could not delete it. But then I could!

Page shows some text, then an empty line then a row of about 10 hyphens

Type ten or so hyphens

Page shows the hyphens now converted into a horizontal line across the page

After hitting Enter, we can see the little menu that allows us to undo the autoformatting

At this point, we can undo the line if we want to by clicking on the menu icon that comes up when Word automatically creates the line, and we could select Undo Border Line, Stop Automatically Creating Border Lines or Control AutoFormat Options. So at this point it is easy to remove the line.

Screen shows the menu beside the line

The autoformat menu we get on producing the line

But let’s say we want to keep the line for now and delete it later. We go on, typing some more text below  the line. The autoformat menu icon disappears and does not come back.

More text below the line

Now, how can we get rid of the line? First, highlight it by keyboard or cursor.

The line (well, just the first bit of it) selected

Select the line

Now, type Ctrl+Shift+n — the line goes away! Now, this is Word key binding for ‘Apply the Normal style’, which means you can get the same result by using the Styles pane or clicking Normal on the styles ribbon on the Home tab.

Screen shows

text above and below, but no line! Fixed!

If the Normal style does not work, you can also try the ‘Clear All’ option at the top of the Styles pane.

Screen shows the same document with the Styles pane opened

Using the Styles pane

No longer vexed

Rainbowstream – twitter on the command line

Rainbowstream lets you read, post to, search and almost everything else twitter requires — and from a text terminal. No need to run a GUI or anything fancy.

You just type reasonably mnemonic commands at a prompt. To print off the last 20 tweets in your home stream, you type:

[#username] home  20

Where ‘[#username]’ is the prompt. To get some help about tweet commands, type:

[#username] h tweets

You can favourite, retweet, follow links (sometimes) and so on. To show the last 5 tweets about some topic, you’d type:

[#username] s some topic

And so on. It installs via pip — that is, it’s a Python program. The simplest thing in my experience is to do as the instructions say, then make a soft link in your bin directory.

It may throw some errors about `the twitter stream API’. I believe some aspects of the API have been redesigned and don’t work with rainbowstream; I don’t really know, but the website has some information. But the interactive stuff seems to work fine, so it remains useful.

This is an extract from the install instructions at the website:
GitHub – orakaro/rainbowstream: A smart and nice Twitter client on terminal written in Python.

$ sudo apt-get install python-dev  libjpeg-dev libfreetype6 libfreetype6-dev zlib1g-dev
$ cd installs/
$ virtualenv venv
$ sudo apt install python3-venv python3-pip python-pip
$ sudo pip install virtualenv
$ virtualenv venv
$ source venv/bin/activate
$ pip install rainbowstream
$ ln -s /home/username/installs/venv/bin/rainbowstream /home/username/bin/rainbowstream
$ rainbowstream -iot

And away we go.

gsftopk and 8.3 filenames

Note to self — nothing to see here.

I sometimes play with emTeX inside DOSBox. The DVI viewer is very nice.

Sometimes, I have a font that the DVI viewer will not render, even though I can LaTeX and (often) dvips the file no worries. The viewer, dviscr, needs packed bitmap pixel files (xxxx.pk) of each size, and in the right place in the emTeX directory tree, usually in C:\TEXFONTS.

Say I want to generate the pncr8r pk file at 180 size, using the old DOS file name convention, then put it where dviscr will find it.

I sometimes use the the Linux machine that hosts the DOSBox session:

$ gsftopk --dosnames pncr8r 180
gsftopk(k) version 1.19.2/927
[1] [2] [3] [4] [5] [6] [7] [8] [9] [11] [12] [14] [15] [16] [17] [30] [31]
[32] [33] [34] [35] [36] [37] [38] [39] [40] [41] [42] [43] [44] [45] [46] [47]
[48] [49] [50] [51] [52] [53] [54] [55] [56] [57] [58] [59] [60] [61] [62] [63]
[64] [65] [66] [67] [68] [69] [70] [71] [72] [73] [74] [75] [76] [77] [78] [79]
[80] [81] [82] [83] [84] [85] [86] [87] [88] [89] [90] [91] [92] [93] [94] [95]
[96] [97] [98] [99] [100] [101] [102] [103] [104] [105] [106] [107] [108] [109]
[110] [111] [112] [113] [114] [115] [116] [117] [118] [119] [120] [121] [122]
[123] [124] [125] [126] [130] [131] [132] [133] [134] [135] [136] [137] [138]
[139] [140] [147] [148] [149] [150] [151] [152] [153] [154] [155] [156] [159]
[161] [162] [163] [164] [165] [166] [167] [168] [169] [170] [171] [172] [173]
[174] [175] [176] [177] [178] [179] [180] [181] [182] [183] [184] [185] [186]
[187] [188] [189] [190] [191] [192] [193] [194] [195] [196] [197] [198] [199]
[200] [201] [202] [203] [204] [205] [206] [207] [208] [209] [210] [211] [212]
[213] [214] [215] [216] [217] [218] [219] [220] [221] [222] [223] [224] [225]
[226] [227] [228] [229] [230] [231] [232] [233] [234] [235] [236] [237] [238]
[239] [240] [241] [242] [243] [244] [245] [246] [247] [248] [249] [250] [251]
[252] [253] [254] [255]

$ cp pncr8r.pk /path/to/TEXFONTS/PIXEL.LJ/180DPI/

Then, back in DOSBox, refresh the file tree

Ctrl+F4

Then it works.

Note that the main difference between pk files on Linux and DOS is that DOS can only use 8.3 file names, so it omits the scale number (180 in this case), which means that copying into the correct directory, with name of the form XXXDPI where XXX is the number, is vital because that is how dviscr selects the correct pk file.

Note also that dvips will resort to using the .pk files to generate the PostScript if there is no PostScript font available, so doing this will sometimes fix missing glyphs in dvips output.

emTeX

Pro-Cite 2.2 + WordPerfect 5.1 cheat sheet

From an old WordPerfect 5.1 document

This is a summary of part of the Basic guide to Pro-Cite, section ‘Creating a bibliography from a manuscript’.

1. Insert your citations in the WP document. Two ways:

  • author/date, like (Smith, 1994) or (Smith & Jones 1987)
  • record number, like (#324) where 324 is the record number in Pro-Cite.

2. Save the document, exit WP5.1.

3. Search for the citations in the document:

  • open Pro-Cite and the Pro-Cite database containing the records
  • in Main Menu, press M for search Manuscript
  • press O for Options and set appropriately
  • F10
  • select all database records
  • F to give the document File name (changing directory if need be), then Enter
  • in Main Menu, press M for search Manuscript, then Enter.

4. Generate the reference list to insert into your document:

  • go to Print menu and set your output format to WP5.1
  • Print the reference list
  • go to search Manuscript and ‘Clear manuscript order’
  • close Pro-Cite.

5. Insert the list into your document:

  • open your document in WP5.1, and move the cursor to where the list is to go
  • Shift+F3 to switch to the second document
  • open reference list, and copy it all
  • switch back and paste it in.

 

I prefer the 20th century.