File creation from command line in Libreoffice

I would like to be able to just type

$ libreoffice /path/to/filename.odt

and create as well as open an odt file. This would save messing around with GUI file dialogues.

This is sort of possible.

$ libreoffice newfile.odt

does not work.

$ libreoffice --writer newfile.odt

does not work.

$ libreoffice -n newfile.odt

does not work.

$ soffice --writer newfile.odt

does not work.

$ soffice --writer 

or

$ libreoffice --writer

opens a blank Writer screen but you then have to use the Save dialogue to name the file.

$ touch /path/to/filename.odt

$ libreoffice /path/to/filename.odt &

sort of works. touch creates an empty file, which libreoffice (or soffice) will open as a text file. If you hit Ctrl-s within LibreOffice you will have to tell it to save as odt, but you don’t have to navigate to the folder you want.

Sadly, giving an extension (odt, odp, ods) does not help LibreOffice choose the right program to use to open the file. They are always treated like plain text and always opened in Writer, even if you type something like

$ touch test.odp

$ libreoffice --impress test.odp

So that’s less than optimal. if one can be bothered, there is a bodge that lets this happen more cleanly. I opened LibreOffice Writer and created a blank file, called blank_writer_doc.odt and put it in ~/bin, and similar for Calc. I don’t use the other tools enough to bother.

Then in ~/bin created the following script, called Writer:

$ cat Writer
if [ -f "$FILE" ]; then
  echo "File $FILE exists. Replace? y for yes, anything else for no."
  read replace
  replace=q$replace
  if [ $replace = "qy" ]; then
    echo "File $FILE overwritten with blank document."
    cp ~/bin/blank_writer_doc.odt "$FILE"
    libreoffice "$FILE" &
  else
    echo "Opening existing file."
    libreoffice "$FILE" &
  fi
else
  echo "File $FILE does not exist. Created."
  cp ~/bin/blank_writer_doc.odt "$FILE"
  libreoffice "$FILE" &
fi

And now I can type

$ Writer newfile.odt$

and it works.

The bit with adding ‘q’ to the response means that the response is never empty, so the if does not barf if the user just hits ‘Enter’. (If if is asked to work on an empty response, you get:

 line 5: [: =: unary operator expected

Writer.

Advertisements

An album a once in a while: All the best cowboys have Chinese eyes

I first listened to The Who when I borrowed one of their anonymous ‘best of’ collections from a relative. I’ pretty sure it was this one. It’s a bit odd in having ‘Don’t let go the coat’ and ‘Sister disco’ on it, though when it came out those were newish songs. It’s also got ‘Tommy, can you hear me’, as a sort of prelude to ‘Pinball wizard’. I liked it, I kept an eye out for other similar stuff and not long after I picked up a cheap tape (this was quite a while ago) of All the best cowboys have Chinese eyes. Not really an album for the young. It’s one of Townshend’s ‘I am so messed up’ albums, the main other one being The Who By Numbers, although it’s a subtext in much of his work. Songs like ‘Slit skirts’, which begins with ‘I was just 34 years old’ and includes ‘once she woke with untamed lover’s face between her legs/now he’s cooled and stifled and it’s she who has to beg’ don’t really resonate when you’re 13. Not with me, anyway.

Scan of the cassette insert.

Cassette tape insert for ATBCHCE. Pretty minimal compared to the vinyl sleeve. Can’t really even read it.

On the other hand, ‘Uniforms’, about the need to fit in made more sense, and ‘Communication’ doesn’t make sense to anybody, 13 or 34 (‘Selbstdarstellung/Gay Talese/Ronald Rocking/Euthanasia’).

The album uses a lot of syths, though there’s plenty of guitar too.

It certainly polarises fans.

It’s often called pretentious and confusing, though really, apart from ‘Communication’ it’s not really that impenetrable (I say now, many years after first hearing it). And it’s replete with catchy tunes. It’s quite possibly his most melodic solo album, though the use of synthesisers hides that a little and dates it quite markedly.

What it’s not is a rock album. Where Empty glass rocks like a Who album (even though lyrically it would have made a strange one), this does not — it’s too poppy, though it has plenty of energetic moments, like ‘Stardom in Acton’ (the germ of White City, I’m sure) and ‘Slit skirts’. This is not a solo album designed to keep the Who fans happy. This is Pete Townshend following his muse where it leads him, which in this case is a cross between mid-life crisis and the mainstreaming of electronic instruments in the early 80s — it’s basically a new wave record by a guy from the old wave. No wonder a lot of fans who have bought all the Who albums they can and are looking for more product don’t like it!

If you’re a little more open-minded, it’s actually pretty good, though it does make me feel a little like Pete’s therapist. I should charge him each time I listen to it.

Yes, it sounds like 1981. But pop music recycles itself so often, who cares? Yes, there’s spoken word stuff and what looks like free association poetry. But risking being perceived as pretentious is something integral to a lot of really interesting art. Yes, there’s clunky autobiography and tinny synths and bubbly synths and bouncy synths. What it does not sound like is repetition, like a musician happy to stand still. In The kids are alright Townshend carries on about how it’s ‘crucial’ that pop music progress as art. And amidst the rock operas and the symphonic scores and weird experiments and two chord wonders and synthesiseritis and the boredom of The Iron Man and the tedium of the standard version of Psychoderelict (the music-only version is much better), what you don’t find is a guy who’s just trying to give you what you want. Somewhere in his autobiography he says something like ‘we could have just done Who’s next part 2′ in 1972, and then explains why that’s not adequate; yet I have no doubt that thousands of fans would have been quite happy with that. I would have, had I been around at the time. Instead he put together Quadrophenia, a giant flawed masterpiece that in many ways is less enjoyable than a retread of Who’s next might well have been. (Let’s see … ‘Pure and easy’, ‘Naked eye’, ‘Join together’, ‘Relay’, ‘Let’s see action’, ‘Baby don’t you do it’ … yes, there’s most of a solid follow up there just in the non-album singles and Who’s next rejects.)

Favourite tracks? I don’t usually skip any, though ‘Sea refuses no river’ and ‘Somebody saved me’ can get a bit … I dunno. The phrase ‘first world problems’ comes to mind.

Face Dances, Pt. 2
Communication (for the drums and ‘by satellite and solid state’ and because it’s called ‘Communication’ and tells us to communicate while being largely incomprehensible itself)
Stardom in Acton
Uniforms
North Country Girl
Slit Skirts

Oh, and don’t read any of Townshend’s prose. (Same goes for the back of White City). I don’t know about the CD or download, but the LP comes with this weird essay inside the cover (‘the triangle expands and explodes’ or something), and it really is a weird lump of arty-farty nonsense that the album would be better without. I suspect one reason I like this is because for years I just listened to my old tape, and that is free of the gobbage. Indeed, it has a song on it called ‘Stardom in Action’ (probably ‘corrected’ by a proofreader), so it’s hardly packaged with the care of the vinyl release.

Scan of the cassette itself.

Note track 1 on side 2; ‘Stardom in Action’. At least it’s not ‘Stardom inaction’.

Worth a spin, possibly especially if you don’t like the Who.

 

What else?

Predatory or legit? I dunno, but … GBP1500?

Predatory publishers or legit? It’s not always easy to spot. What about this one?

screeenshot of email asking me to contrinute to a book chapter; text extracts below.

Email from InTechOpen asking for a contribution to a book chapter.

Note how the list of institutions is empty!

Dear Dr. Goossens,

Due to your involvement in the field, and the research you published in your paper, “Synchrotron X-ray diffuse scattering from a stable polymorphic material: Terephthalic acid, C8H6O4,” IntechOpen invites you to extend your work and offer a more comprehensive overview of your studies. Contribute a chapter to “Synchrotron Radiation,” an upcoming Open Access book edited by Dr. Name Name.

Work with an internationally recognized peer group and gain increased visibility for your published work. Please visit the book project page to register your interest.

We look forward to hearing from you.

Kind Regards,

Marija Gojevic-Zrnic, from IntechOpen
Author Service Manager

It’s correctly written, their website looks more or less professional, their books do certainly get printed and distributed — I’ve seen them in proper libraries. They’re open about their (high in my opinion) fees — £1500 for a 16 to 20 page chapter. So are they predatory or just expensive? I guess they’re just expensive.

I still would not publish with them.

Why?

Something like IUCrJ (fee of USD1300, or about £1000, so quite a bit cheaper) covers similar topics, is also open access, is part of a society publisher of high standing, has a reliable archiving policy and is embedded in all the major search engines and databases. I have no experience with the editorial process at InTech, and it may be very good, I can’t say, but I do know that the IUCr process is superb, with their editors doing more than just farming out the material to review — they genuinely interrogate it themselves.

The issue? IUCrJ might bounce the work! Also, book chapters are often more review-y and may not be publishable as papers.

But … if you are career-conscious, ask; will the book chapter collect citations anyway? Will it fall through the cracks of whatever research metric engine your bosses want to see quoted? Sadly, this is the reality. Monographs and book chapters might be excellent and important, but will they be noticed? I suggest finding a good-looking chapter or two from an InTech or similar volume and then checking its stats in whatever database you use for citation and impact metrics — Web of Science or whatever. Is it there? Are the numbers reasonable? And so on.

In the end, if you want to go open access, there are reputable journals that will take your money, and £1500 is enough to get into some pretty reputable ones. And conventional publication still exists. InTech might be OK, but check it out first and be aware of the options!

It’s all about due diligence.

 

 

Successful science writing and editing

Recently I attended a workshop called ‘Successful science writing and editing‘, facilitated by Kath Kovac, a freelance editor and trainer who often works with Biotext, my employer. Kath did a great job. She has a lot of experience in writing and editing technical material, built up over many projects working with CSIRO and many other organisations. She wears the erudition lightly, which is great.

While a lot of the material was familiar — after all, I work in the area — it was good to see how another professional thinks about it and talks about it. Every editor has their own set of things that irk them. It seemed to me Kath is particularly attuned to pointless openings to sentences. Sentences that begin with ‘There are’ or ‘There is’ or (worse) stuff like ‘It should be noted that’.

For example:

Instead of: There are many sentences that, like this one, are longer than necessary.

How about: Many sentences, like this one, are longer than necessary.

It seems like a small change, but if every sentence gets a little sharpening, the whole document gets an amazing lift. It becomes more engaging, clearer and easier to read and understand. Some writers do this instinctively, the rest of us have to make conscious checks.

I also enjoyed the contributions of the attendees. No matter how familiar the material, the people are always new when you’re training or educating, and that keeps it fresh. A microbiologist gave us the definition of biosolids. We explored structuring documents, and the example was a fact sheet about the benefits of eating quoll.

All in all, a very enjoyable and illuminating experience! Though we never got to taste quoll.

I even got a certificate.

 

Training

 

AlphaServer 1200 — Gentoo, OpenBSD or NetBSD? Or quite old Debian?

There’s a question about what to run on it. OpenVMS on one HD makes sense, just to see what it’s like. Other OSs that are still available include NetBSD, OpenBSD, Gentoo — that’s about it. There’s a Debian community supported option out there http://backup.parisc-linux.org/, which is a mighty effort but which is likely to require some hacking to work. A small group of enthusiasts just can’t be expected to test stuff on all different types of hardware.

Here I sum up my experiences so far, given I am in mid-process.

Debian: Official Debian support for Alpha ended with Debian 5.0.10, the last update to Lenny, in about 2012. That makes it vulnerable to security exploits, though one suspects that anything that depends on a hardware exploit is pretty unlikely — how many nasties are out there targeting Linux on Alpha? If security by obscurity is ever going to work, this is it! On the other hand, once the system is installed there’s no update cycle to worry about, and the software ecosystem is pretty big (no Open/LibreOffice, but that’s about it). I’ve got a whole post on putting Debian 5 on the thing. Short answer: (almost) works right out of the box.

OpenBSD: Installs effortlessly, but lacks an X server, though does have some X tools. I guess that means you could use X on the machine if you had a second machine acting as the server, or maybe try to use the NetBSD ports/pkgsrc route. OpenBSD looks like a good option for a server or if the text terminal is your thing.

NetBSD: Installs just as easily. X is there, just haven’t quite got it to work. Since OpenBSD can be made to play with NetBSDs source packages, it may be possible to get X onto OpenBSD in a roundabout way.  Tried to compile X and to install ‘modular X’ (https://wiki.netbsd.org/pkgsrc/how_to_install_modular_xorg/) but compile of the server failed with various problems with the C code which I am not in a position to wrestle with (‘cos I don’t know enough C and I do not intend to spend my time learning it). Looks like the code just does not dovetail with the Alpha. I’ve not given up yet. NetBSD without X seems to work fine, I should add, and X is not everything.

Gentoo: Life is too short for this! Actually, I intend to have a crack. Already tried once and failed but I think that was me not Gentoo — made some mistakes with the (long and arduous) install process and ended up with a broken system. Need to try again.

Debian unofficial: The 9.0 install media would not boot on my machine. The 8.0 booted and installed but X does not work out of the box and ‘$ Xorg -configure’ throws a seg fault. Lots of ‘unaligned traps’ suggests that a lot of the code base has not been customised for one of the unfortunate quirks of the Alpha architecture. Tried importing the xorg.conf from Deb 5 but it did not like that.  May need to recompile X.  Experimenting with apt-src, but looks like this is not going to work without a lot of hands-on.

I have 3 SCSI HD I can use. Debian 5 is working well. I’d like to have a BSD for interest. So Gentoo or Debian unofficial? I’m inclined towards having another crack at Gentoo. Especially now that I have increased my internet download limit.

 

Compile it.

 

A document about inserting nonkeyboard glyphs when working in Microsoft products

See djg.altervista.org for a PDF. It’s just a short document about inserting nonkeyboard characters into Word documents and other Microsoft products.


That’s it, f-f-folks.

Dillo on Debian: weirdness 2

I noted that Dillo often fails to open the page I go to, or renders it as blank or something. A bit more investigation revealed that the search engine choice is key.

This may be well known, but…

…here is my demo.

I open Dillo, click on the magnifying glass and select Duck Duck Go from the list of search engines and search for:

hermes 10 electric typewriter

and get these results:

Screenshot showing search results.

Results of Duck Duck Go search for hermes 10 electric typewriter

So I click on the second entry (Typewriter manuals) and I get this:

Screen shot of result of clicking through from search results.

Empty screen on clicking through from Duck Duck Go search.

Not very useful. OK, try the same search with Google. Find the same website (http://site.xavier.edu/polt/typewriters/tw-manuals.html) and yes — I can click through:

Screenshot of the webpage.

The typewriter manuals webpage.

It also works through Bing.

Now, this behaviour seems to be erratic. I’ve had other pages that I could not click through to from a Google search. I can almost never click through from Duck Duck Go, and Bing seems the most reliable, possibly related to this here. It’s a bit unfortunate, given that Dillo recommends Duck Duck Go by default…

Anyway, just a little note FWIW.

FWIW.

AlphaServer 1200: adding sound

Had an ancient Creative Technologies SoundBlaster in the shed: Model: CT5803.

Perfect vintage for a box from 1998 running Debian from 2012. Specs of card:

Creative Technology Ltd

DP/N 00074HUW

Sound Blaster Audio PCI 64 Dell/Gateway

(1) Turned box off and unplugged power cords.

(2) Already had Debian 5.0.10 installed. Slotted card into a PCI slot, screwed it in tight, closed up the case and booted up.

(3) (Re)installed a bunch of sound stuff — libasound2, alsa-utils, alsa-oss mainly. Used synaptic and just asked for a reinstall of anything alsa, basically. Also chose a couple of sound mixing applications. One of their dependencies might be crucial, not sure.

(4) Rebooted.

During boot saw: Setting up ALSA … Done

Promising!

(5) Opened ‘Sound’ on the System/Preferences menu and did tests. Yep, works!

(6) Got a screenshot just to put a pic in this post. Sadly, old versions of browsers won’t work with WordPress (old version of JavaScript is probably the issue), so copied the file off the Alpha to my main box using scp over my local network.

Screen shot with no useful content.

Sound works.

Got to say, it was as easy as that. Did need the reboot, but can’t complain. No monkeying about with firmware or anything. Debian roolz!

 

Sound.

PDF booklet-y stuff using pdfjam and pdftk

Say you scan an A5 booklet by opening it flat and scanning each pair of pages. You can then print it out in landscape, stapled on the left and you can read the whole booklet in order. But the pages are out of order if you want to make a new saddle-stapled booklet.

So, let’s say I have a PDF like this one: http://site.xavier.edu/polt/typewriters/quietriter.pdf

Scrteenshot of the pdf, showing the arrangement of pages.

Spread from the PDF of the booklet — pages 4 and 5 scanned onto a single landscape A4 or letter paper page.

And I want to rearrange it so that I can make it into a proper (roughly A5-sized) booklet, stapled in the middle rather than along the edge. Well, there might be a tool for this, but …

(1) We open it in gv and find out that it’s 788 wide, half of which is 394. It’s also 598 high.

(2) Use pdfcrop.sh to make 2 PDFs, one of the left half and one of the right half.

$ pdfcrop.sh -t "0 0 394 0" quietriter.pdf quietriter1.pdf
$ pdfcrop.sh -t "394 0 0 0" quietriter.pdf quietriter2.pdf

Looks good. (Hint: Some PDF viewers don’t view the cropped files correctly — if it looks wrong, try a different viewer before messing with the dropping commands).

Page order in quietriter1.pdf is: back cover (24) inside front cover (2) 4 6 8 10 12 14 16 18 20 22
Page order in quietriter2.pdf is: front cover (1) 3 5 7 9 11 13 15 17 19 21 23

(3) Now, for booklet order, the simplest thing to do would be to put these in order (1, 2, 3, …, 24) then use pdfbook (part of pdfjam).

Sounds like a job for pdftk …

First, we’ll put the first page of quietriter1.pdf to the back. From what I can see, this should work:

$ pdftk quietriter1.pdf cat 2-12 1 output quietriter1a.pdf

(This conCATenates the selected page ranges in the order given.)

(4) Then we interleave 1a and 2 using shuffle, which is designed for just this sort of job:

$ pdftk A=quietriter1a.pdf B=quietriter2.pdf shuffle B A output quietriter_inorder.pdf

(5) Then we use pdfbook to reorder into booklet order.

pdfbook quietriter_inorder.pdf

That gives quietriter_inorder-book.pdf.

(6) We print the file double-sided with flip on long edge. (I just printed it from Acrobat, having done the command line manipulation running the PDF tools within Cygwin.)

(7) Looks good! Of course, there are no bleeds, but a quick saddle staple and then trimming with a guillotine and it looks very nifty, and a lot like an original booklet.

photo of the typewriter and manual.

The Remington Rand (Sperry Rand) Letter-Riter (what a terrible name for a typewriter!) with a facsimile of the manual, produced as outlined here.

 

Booklet.

A little fix on a Hermes 10

So my Hermes 10 had a little problem; the ribbon vibrator was not dropping down after lifting the ribbon into place. That meant my deathless prose was obscured. Given how many errors I make that may not be a bad thing, but still…

Bitmap image of the typewriter.

Hermes 10 electric typewriter with the upper casing removed.

 

bitmap of the problem part with the part highlighted

Sticky ribbon vibrator indicated by the red arrow.

I tackled it two ways, both at once, so I don’t know which was more important.

First, I just very lightly lubricated the various bits of the mechanism, working from the ribbon position all the way back to the various lever arms and whatnot near the keyboard.

In doing this, I noticed that while there was a spring drawing the mechanism back (and the vibrator down) attached near the top-right of the keyboard, there was no such at the top-left.

bitmap image showing the spring that was already in the machine.

The arrow points to the spring near the top-right of the keyboard. It draws back the ribbon vibrator mechanism, causing the ribbon to drop out of the way.

Now, in most manual typewriters the vibrator is not symmetrical — it’s operated from one side or the other but not both, so such an arrangement would not be that much of a surprise. But on the 10 the mechanism is more symmetrical, with levers and rods on both sides and the ribbon holder moving perfectly vertically on a rail rather than being lifted up by a lever arm from one side. So it seemed reasonable that there should have been a spring on the left, especially since there was a little pin there with nothing to do but hold the end of the absent spring.

bitmap showing the spring

The mismatched spring I added to the mechanism on the top-left.

 

To cut a boring story a little short, I found a little spring in my parts bin (not matching, but that’s OK) and attached it, and an the problem went away.

The 10 is not a bad machine. It combines the evenness and regularity of an electric machine with the satisfying thwack of typebars on paper. Its gentle hum is not disturbing. It is a heavy beast — portable only in the sense it is not bolted down — and the key tops sit high due to the electrical paraphernalia underneath. But typing on it is effortless and the result is very tidy.

And now, thanks to my fiddling about, the ribbon vibrator gets out of the way and lets me see what’s going on.

Here are some more pictures.

image of the typewriter, without its upper case.

Some more pictures of the topless Hermes 10.

It certainly isn’t the most invisible fix I’ve done, but it works and makes the machine much more user friendly, so worth doing indeed.

10 10 10 10.