Get some vim and vigour

Little helper.

A photo posted by Beth McMillan (@teraspawn) on

I have a peculiar fondness for programs that you can use at the terminal without having to pop out into something graphical, because I spend a lot of time logged into machines that I'm not physically sitting at, and which don't always have a great deal of memory. I used to use Nano for making small changes to files, Gedit for web design and Python, and Eclipse for C++. Since learning to use Vim, I now use it for everything.

There is a steep learning curve at the beginning. It took me a long time to get used to having two different modes for editing and reviewing, and I still have trouble navigating around the text - if you use the arrow key to get to the end of a line, you don't automatically end up on the next line, which I find very jarring. However, the useful features of Vim far outweigh the minor inconveniences.

The basics

To go into "insert" mode, which lets you edit the document, press i. To get back into "normal" mode, where you can enter commands, press Esc.

To save, go into normal mode and type :w, then press enter. To quit, use :q, or to quit without saving, type :q!. You can also string the two commands together and type :wq to save and quit.

All of the following commands are to be typed in normal mode. If a command begins with a colon, you have to press enter before the command will execute.

Undo and redo

Press u to undo, and Ctrl-R to redo.

Copy and paste

To copy a line, press Y, and then to paste either press p to paste below the current line, or P to paste above. To cut a line, type dd.

To highlight a block of text, either type v to highlight by the character, or type V to highlight by the line. You can then copy the text by pressing y, or cut the text by pressing d. This text can then be pasted as above.

Find and replace

You can use regular expressions in Vim to find and replace text. The simplest one, which I use the most often, is :%s/foo/bar/g to replace each instance of "foo" with "bar".

Smart indent

To indent your whole file at once, type gg=G, or type == to indent the current line.

Finding words

Type /word to find each instance of "word" in your file. Press n to move to the next instance, or N to move to the previous instance. Once you're finished, you can turn off the highlight by typing :noh.

Autocomplete

Autocomplete words, commands or variable names using Ctrl-N.

Opening multiple files in tabs

If you're editing a few files at a time, you can open them all up at the same time and switch between them using tabs. Use :tabe filename to open a file in a new tab, then to switch between tabs use :tabn for the next tab and :tabp for the previous tab. You can see the tabs at the top of the screen. If you want to close a tab, use :q as normal.

Vim is really the Dwarf Fortress of text editors: there are layers and layers to it that I haven't yet discovered. I have the Vim graphical cheat sheet printed out and pinned up next to my desk, and I find if I google something like "Vim record macro" there will usually be several helpful tutorials available.

Happy coding!

...

Grammar tips for scientific writing

I have a side job for a few hours a week editing scientific papers. I thought I'd share a few of the problems that I come across most often.

What's the point in this?

Language is an ever-evolving thing and grammar and spelling can, and do, change over time. However, it's important to have a grasp of the language rules that are in common usage. When people are communicating with each other they need to have a common language so that ideas can be conveyed unambiguously. Mistakes in grammar and spelling can lead to a lack of clarity. Additionally, small mistakes can cause readers to stumble while they're reading your text, which distracts them from your main point.

Style guides

The first port of call when formatting your paper for publication is the style guide of the journal you're sending it to. They'll often have specific things to say about referencing, units, and structure.

Fewer/less

Fewer is used for countable, discrete quantities, and less is used for continuous quantities. Example: fewer apples, less sand.

Affect/effect

For the most common usage (i.e. a change in something), affect is a verb, and effect is a noun. An example from Grammar Girl:

The arrow affected the aardvark. The effect was eye-popping.

Rarely, you might see affect being used as a noun and effect as a verb, but these words have different meanings - an affect is an emotional state, and to effect is to bring into being. Example: the secretary had a positive affect when he effected a new filing system.

In general, just remember the aardvark.

The Oxford comma

The serial, or Oxford comma comes before the last item in a list. For example: lions, and tigers, and bears! (Oh my!)

It's seen as somewhat old-fashioned, but can often add clarity. It's acceptable to miss it out in most lists, and only add it where it's necessary to disambiguate something.

With the Oxford comma: we invited the strippers, JFK, and Stalin. Without the Oxford comma: we invited the strippers, JFK and Stalin.

Species names

When talking about a species by its Latin name, the genus name is capitalised, the species name is given in lowercase, and the name is italicised. If you're shortening the genus to its first initial, the initial has a full stop and a space after it, not a hyphen. So you would say E. coli or Escherichia coli, not e-coli, E.coli or E. Coli. The first time you talk about the organism, you should use the full name.

et al.

You may want to shorten references with multiple authors by using et al. There is a full stop after al and not after et. Sometimes et al. is italicised, but not always - this will depend on the style guide of the journal you are submitting to.

Synonyms for 'use'

I realise it can get boring to use the same words over and over again, but sometimes repetition is the best thing for clarity. The word use  crops up a great deal in methods sections, and so do other words in its place. Employ is a word I see very often in this context. Unless you're giving your reagents a job, don't use employ to mean use. The word utilise gets a bad rap, but it's useful in some contexts: it doesn't mean use, it means make use of. Example: Vitamin C helps the body to utilise iron.

Tenses

Expectations on whether to use the past or present tense vary wildly between disciplines. In biology, you often use the past tense for methods and results, and the present tense for conclusions and stating general facts. Take your cue from other papers in your subject area.

Passive vs. active voice

Active voice: I ate the cake. Passive voice: the cake was eaten.

I don't know about you, but I learned at school that in scientific writing, the passive voice must always be used. This is old-fashioned advice: the active voice is just as acceptable. The important thing is to pick an option and be consistent: for example, you could use the active voice for things that you do, and the passive voice for other peoples' studies.

Beginning sentences with 'and', 'but', or 'because'

No.

Further resources

I recommend Lynne Truss' book, Eats, Shoots & Leaves as a general primer on these things. You can also check out the Guardian Style Guide (they also have a Twitter feed!)

If you find yourself grasping for words when you're writing, the Academic Phrasebank can be a useful tool for finding sciencey words to use. However, remember that clarity is far more important than style: if the boring way to write it is the most unambiguous, it's the right way to write it.

 

...

Conference travel hacks

Summer is here and with it comes wave after wave of conferences. Here are a few ways to make conference season a little more pleasant and a little less stressful.

Packing

Having a master packing list that you consult each time you go away is the only way to make sure you don't forget anything important. Don't forget any medications that you take, earplugs, cables for electronics, pyjamas, and toothpaste.

I know it's old advice, but rolling your clothes is a great way of fitting them into your suitcase. It also means you can pull them out when you need them without having to extract them from layers of other clothes. People say it reduces wrinkling, but my other half summed it up rather succinctly when he said "it's not that you don't get creases - they're just different creases."

Roll clothes to make them fit into your suitcase.

I made a great decision a couple of years ago when I bought a pack of 10 clear plastic pencil cases. I use them for everything - make-up, medication, craft supplies, snacks, cables... If you put all your small items into clear pencil cases, you can see at a glance where they are.

Use clear plastic pencil cases for small items

I put together a little first aid kit to remedy any of the small things that would be annoying - bonjela in case of a mouth ulcer, eye drops and antihistamines in case of the dreaded pollen, antacids for stomach ache, painkillers for headaches, and plasters for small wounds.

Travel

A little folding travel plug like this one can be very useful to slip into your handbag with a USB cable for charging on the go.

When it comes to dressing for travel, comfort is key. I love stretchy clothes like leggings, t-shirts and hoodies. If you've got any sports clothes made out of moisture-wicking fabric, these are great for travelling on a hot day as they stop you feeling sweaty.

Have you ever wanted to watch the scenery rush past out of a train window, but been stopped by a big greasy forehead mark from whoever was sitting there before you? Bring a little packet of wet wipes so you can give the window a wipe and have an unobstructed view.

I don't have many other travel tips apart from - bring a book and don't put your bag on the seat next to you on a busy train like a jerk.

Hotel room hacks

Most hotels that cater for UK or Irish guests will have tea, coffee and a kettle in your room (for hotels without, my mum brings a tiny travel kettle). The tea and coffee supplied might not always be your preferred type, so I like to bring a few tea options with me (chamomile and Earl Grey are my favourites). I'm not a coffee drinker, but I've seen a few people with this AeroPress, which you put on your mug to make filter coffee for one.

If you get a stain on something you'd like to wear again, this travel wash is a great, concentrated solution that you can use in your hotel sink.

When your crumpled clothes emerge from your suitcase, a sensible person might iron them. However, if you, like me, hate ironing enough to never do it unless strictly necessary, an acceptable second choice is to hang up the garment in the bathroom before you have a hot shower. The steam will help some (but definitely not all) of the creases to drop out.

If I'm feeling particularly energetic I find it helpful to do a small workout before bed. Some exercises that you can do without equipment, that don't make weird thumping noises to disturb your neighbours, are salute to the sun, lunges, squats, planks, and most types of crunches. Equally, sometimes an exercise regime has to take a backseat to relaxing.

Poster printing

If you can, try to find a poster printing shop near to your venue so you don't have to lug a poster tube over on the plane. I've done this at my last two conferences, and it gives you a little extra time for putting the finishing touches on your poster as well as preventing problems with posters getting lost or crumpled. In both cases, it was also cheaper than getting it printed by the university!

...