How to Insert Images into a Scrivener Document

1. Select the desired document, and click within the editor in the exact location where you’d like to insert the image.

2. Type `<$img:ImageName>` (where ImageName is the name of the image as it appears in the Binder).

**NOTE**: To determine the size of the image, you can enter either its height or width and the image will adjust the other measurement accordingly. You can also enter both dimensions, if desired. Do so in the following manner: `<$img:ImageName;w=100>` to assign a width of 100 pixels

The Complete Python for Text Analysis

The following set of commands assume that you begin with a Mac OS X that does not have any of the necessities already installed. You can, thus, skip anything you have already done, e.g., if you have already installed Xcode, skip to Step 2.

Step 1: Install the Xcode development and command line tool environment. You’ll have to get Xcode from the Mac App Store. Supposedly, you can avoid this by simply installing the command line tools (see command below), but I have come across at least on instance where it seemed like I needed to go inside Xocde itself and download and install things from within preferences. (This was the old way of doing it.) Here’s the terminal command to install the Command Line Tools (a bit redundant isn’t it?):

xcode-select --install

Nota bene: I continue to see warnings when installing Python and its modules when I have not installed the complete Xcode from the App Store. They look like this:

Warning: xcodebuild exists but failed to execute
Warning: Xcode does not appear to be installed; most ports will likely fail to build.

I am installing the complete setup now on another machine, I will update this post if anything is borked.

Step 2: Install MacPorts.

If, like me, you have recently upgraded your operating system and things are borked, then you need to clean out the old installation(s). This means downloading the installer and running it like you did when you were young. It’s still fast and easy. The uninstallation is also fast and easy. Cleaning, however, takes some time. The steps below first document what you have installed before working you clean everything out:

port -qv installed > myports.txt  
sudo port -f uninstall installed  
sudo port clean all  

You can use the myports document as your list. (The migration page at MacPorts does have a way to automate the re-installation process using this document. Try it, if you like.)

At any rate, once you have MacPorts installed, pretty much everything else you need is going to be found and then installed via port search and then port install.

Step 3: Now you can start installing the stuff you want to install, like [Python 2.7][python]:

sudo port selfupdate  
sudo port install python27  
sudo port install python_select  
sudo port select --set python python27  

Step 4: Install everything needed for the NLTKnumpy, scipy, and matplotlib:

sudo port install py27-numpy  
sudo port install py27-scipy  
sudo port install py27-matplotlib  
sudo port install py27-nltk  

At this point, if you are only interested in NLP (natural language processing), you are done.

Optional: If you are going to pull anything from websites, then you can make your life easier by getting Beautiful Soup, which parses HTML for you:

sudo port install py27-beautifulsoup4

(Check for versions, as it may have incremented up.)

Step 5: If, however, you are also interested in network analysis as well as topic modeling and other forms of “big” data analysis, you can also install three Python modules built to do so — NetworkX, Gensim, and pandas:

sudo port install py27-networkx
sudo port install py27-gensim
sudo port install py27-pandas

Step 6: You have a pretty powerful analytical toolkit now at your disposal. If yo would like to make the user interface a bit more “friendly,” let me suggest that you also install iPython, an interactive Python interpreter, and, the best thing since someone sliced something in order to serve it the iPython notebook:

First, iPython:

sudo port install py27-ipython  
port select --set ipython ipython27  

Then, the iPython notebook components:

sudo port install py27-jinja2  
sudo port install py27-sphinx  
sudo port install py27-zmq  
sudo port install py27-pygments  
sudo port install py27-tornado  
sudo port install py27-nose  
sudo port install py27-readline  

I can’t tell you what a joy iPython notebooks are to use: you can copy complete scripts into a code cell and get results by simply hitting SHIFT + ENTER. And everything is captured for you in a space where you can also make notes on what you are doing, or, in my case, trying to do, in markdown. Everything is saved to a modified JSON file with the extension ipynb. Even better, you can transform the file, using the nbconvert utility, into HTML or LaTeX or PDF. It is very, very, nice.

Options: if you want that LaTeX option for nbconvert to work, you are going to need a functional TeX installation:

sudo port install texlive-latex

Nota bene: In my experience, any TeX installation is big, so if you are in a hurry, either open up another terminal window (or tab), do something in the GUI, or go fix yourself a cup of coffee. It’s going to take a while, and unless staring at the installation log as it scrolls by is your thing, and, hey, it could be, I suggest you let the code take its course and get some other things done.

And, if you need to convert scanned documents into text, the open source OCR application Tesseract is available:

sudo port install tesseract

You’ll need to install your preferred languages, in my case:

sudo port install tesseract-eng

See this search for tesseract for all the languages available.

Afterword: There is also, sigh!, a machine learning module for python called SciKit that does all kinds of things that at this moment in time both excites me and makes my head hurt.



For years — years! — I have been asking the [OmniGroup][] to add jitter lines to my favorite GUI diagramming application, [OmniGraffle][]. My requests have, it would seem, mostly fallen on deaf ears, which had led me to look elsewhere. SketchUp has jitter lines, but using it for 2D illustration work is clumsy at best. I’m still exploring [iDraw][], and so I don’t know how good it will be for the kind of illustrations I produce.

But the really exciting news is that someone has gone and made jitter lines possible in iPython Notebook using `matplotlib` as the generator. This is, of course, not an easy solution, but it is a reproducible one and one that is free and open: [XKCDify][].

Here’s what the before and after look like:



After: XKCDified

After: XKCDified

I found XKCDify among a list of [sample notebooks][].

**Note to software developers**: I remember jitter line functionality being built into the copy of Deneba’s Canvas (?) when I installed it on a Windows 95 (or a Mac?) computer using 6 x 3.5-inch floppy disks, so I’m pretty sure this is do-able. (And the application even let you specify the amount of “jitter” by inputting one or two numbers.)

[sample notebooks]:

iPython Notebook Keyboard Shortcuts

The documentation for the iPython Notebook is top-notch. I am only copying the keyboard shortcuts here so that I have quick access to them as I learn them. I like the notebook interface so much, despite it being browser-based, that I am actually using it as a notebook and I’m doing some drafting of my MLA paper in it. (I’ll report more on this experience later.)

Shortcut Action
Shift-Enter run cell
Ctrl-Enter run cell in-place
Alt-Enter run cell, insert below
Ctrl-m x cut cell
Ctrl-m c copy cell
Ctrl-m v paste cell
Ctrl-m d delete cell
Ctrl-m z undo last cell deletion
Ctrl-m – split cell
Ctrl-m a insert cell above
Ctrl-m b insert cell below
Ctrl-m o toggle output
Ctrl-m O toggle output scroll
Ctrl-m l toggle line numbers
Ctrl-m s save notebook
Ctrl-m j move cell down
Ctrl-m k move cell up
Ctrl-m y code cell
Ctrl-m m markdown cell
Ctrl-m t raw cell
Ctrl-m 1-6 heading 1-6 cell
Ctrl-m p select previous
Ctrl-m n select next
Ctrl-m i interrupt kernel
Ctrl-m . restart kernel
Ctrl-m h show keyboard shortcuts

[sheepish] The keyboard shortcuts are available under the Help menu. [/sheepish]

Randy Schekman Responds to His Critics

For those who don’t know who Schekman is, use the search feature, for those of you who are somewhat familiar with Schekman, here’s a link to his response to the feedback he has gotten so far: [Ars Technica coverage][at] — which appears to be taken from _The Conversation_.

For those who don’t want to RTFA, the four points below seem to be central to his program:

1. Academics who serve a role in research assessment could shun all use of journal names and impact factors as a surrogate measure of quality. New practices and processes must be devised and shared so that we can rapidly move forward. My Berkeley colleague Michael Eisen has added an important point: we must speak up in appointment and funding committees when we hear others use journal names this way. Here we need peer pressure as much as we need peer review.
2. Researchers applying for positions, funding, and tenure should avoid any mention of impact factors in their applications or CVs. Article metrics might have a role to play, but narrative explanations of research significance and accomplishments would be more helpful.
3. Funders, universities, and other institutions should make it clear to their review committees that journal brand cannot be used as a proxy for scientific quality. If reviewers object, they should find different reviewers.
4. Many of us serve as editors or editorial board members of journals—and we could insist that the publishers of these journals stop promoting impact factors. Instead, the journals could emphasise the other valuable services they provide to authors and readers to promote their worth to the community.


Water on Mars

I didn’t know that water on Mars had previously been discussed. Given the job of reading Kim Stanley Robinson’s Mars trilogy, I couldn’t help but imagine a not-so-distant future where the presence of water on Mars becomes central to colonization efforts of the planet.

Sites of dark streaks on Mars

Sites of dark streaks on Mars

See: [Nature](

iOS Device Screen Resolutions

The screen resolutions for Apple’s various iOS devices are:

* new iPads and iPad Minis: 2048 x 1536
* old iPads and iPad Minis: 1024 x 768
* iPhone 5s and new iPod Touches: 1136 x 640
* iPhone 4s and old iPod Touches: 960 x 640

If I want a minimum size for their to be a sidebar, 1000 pixels looks like a good minimum.

The South Is the South

> For instance… let’s take the American “Cold Crusade” against Arabs and Islam. Seen from the perspective of someone who’s not a culturally normative white American and also not an Arab Muslim, this looks like a clear case of being Not So Different at all. In both cases (let’s say, the American South and the Persian Gulf), you’re talking about cultures of fairly poor people, who display a strong cultural preference for rural communities and disdain cities, who tend to build their economies on natural resources and cheap labor, who have strong traditions of hospitality, who have an intense racism in their culture (especially towards their guest-worker populations), who have a low level of average education but a very well-educated elite, who have and support intense inequality, who tend towards religious fundamentalism, who glorify violence, and who tend to restrict the rights of women well beyond what their religion actually calls for.

— on [reddit](