apple   art   china   net culture   productivity   reading   shots/pics   stories   tech   work

Using csplit to chop exported annotations from a PDF into smaller pieces for use with Devonthink
27 September 2012

I read a lot of PDFs, usually in either PDF Expert or Skim. These two programs allow me to export any highlighted sections in the PDF and my comments for these sections in a nice plain text file.

However, usually I end up with pretty large text files – unusable to quickly find the juicy parts or to add (Openmeta) tags to them.1 The bigger these files get, the worse are the AI results from Devonthink too. Consequently, these large files must be split up in smaller chunks for better processing. During the last year I have done this manually but always wished for a more automated solution. Halfway into writing a Ruby script2 for that purpose I found the unix command csplit.

csplit -f t6-jnXXX-note-no_ -n 3 -k xyz.txt /^\*\ Hervorhebung/ {100}

This command will split the file xyz.txt into pieces, starting from the "* Hervorhebung" until this phrase is mentioned again. It does so for the number of times specified in the curly {} brackets and stops with an error when it reaches the end of the document.3 The -f option allows to set a prefix (in this case t6-jnXXX-note-no_; I do name all my articles like this jn001, jn002…). The -k option keeps the resulting files even if the command encounters an error, which (see above) seems to necessary for this to work. /^\*\ Hervorhebung/ is a regular expression, albeit a very very simple one. It just looks for a new line starting with * Hervorhebung. Feel free to replace this according to your needs.

Remember that you can drag & drop any file from the Finder to the Terminal and the correct path and file name are filled in.

Demo time:

This is a sample chunk from a typical annotation file.4

* Hervorhebung, page 1 The very core of this founding reform was institulionnl. A significant number of rights were transferred from collective structures to farm households, and this engaged a dynamics of extension of individual rights that is still far from being over today.

* Hervorhebung, page 1 his importance is well acknowledged by the cen- tral authorities: in January 2010, for the seventh consecutive year, Document No. I, jointly issued by the Central Com- mittee of the Communist Party of China (CCPCC) and the State Council of the National's People Congress (SCNPC), was dedicated to rural issues and land rights problems.

// wie auch die meisten anderen No1 Dokumente seit den frühen 80ern

* Hervorhebung, page 2 The CCPCC launched rural reforms in December 1978 by enhancing the I96I adjustment policies. The collective or- ganisation of agriculture was maintained, but the parallel pri- vate economy was expanded. The most detrimental aspects of central planning were also reformed. State prices were corrected in favour of agriculture, while the constraints of local autarky were relaxed. Finally, the rural People's Com- munes were reformed before being eventually dismantled in 1984.

With the use of csplit this:

* Hervorhebung, page 1 The very core of this founding reform was institulionnl. A significant number of rights were transferred from collective structures to farm households, and this engaged a dynamics of extension of individual rights that is still far from being over today.

Would become a single file.

This would be a second file:

* Hervorhebung, page 1 his importance is well acknowledged by the cen- tral authorities: in January 2010, for the seventh consecutive year, Document No. I, jointly issued by the Central Com- mittee of the Communist Party of China (CCPCC) and the State Council of the National's People Congress (SCNPC), was dedicated to rural issues and land rights problems.

// wie auch die meisten anderen No1 Dokumente seit den frühen 80ern

And so on. Hope this helps someone as much as did help me.

1 I have lost part of my tagging enthusiasm. With roughly a thousand tags for my thesis project alone I sometimes struggle to find the right one.

2 Yes, I’m learning Ruby now and in a strange way Rubys structure and Chinese laws seem to have something in common.

3 I haven’t found a more elegant way to do this yet.

4 Notice the OCR mistakes for bonus points.


Omnifocus to Things Beta Applescript
12 April 2012

I know Omnifocus is great. True GTD. Seamless sync. Hundreds of cool options to deal with your tasks and/or hide them from you. And I’ve tried many times to get the hang of it, but it does not work for me.

Things is much more to my taste. It is far simpler and better looking. After many years of development the new Things Beta now even offers cloud sync. But what to do, if you increasingly frustrated gave OmniFocus a chance for many months and have collect dozens if not hundreds of tasks?

To move your Omnifocus Tasks to the new Beta you can use the following script I took from the Things Wiki (and slightly modified to work with the Beta).

OmniFocus_2_Things.scpt


Ecto and Textpattern
20 Februar 2012

If you don’t use Textpattern you may want to skip this post. Written during a few moments were doing real work was almost impossible but spare computing time was left, this post deals with an offline blogging solution for Textpattern.

Again and again I tried to find a nice tool to streamline blogging with Textpattern – i.e. a tool to avoid using the webpage itself to post stuff. For Wordpress and MoveableType MarsEdit has become the weapon of choice for many. However, somehow it did not work with my setup.

Enter Ecto, which I discovered only recently. Ecto interacts nicely with Textpattern (during the setup stage it even offers the option of a Textpattern blog). Textile works and you can use a custom CSS to preview your post. Remember to set the correct RPC path.

Only adding pictures to a post remains an issue. Textpattern usually requires using a web-frontend to upload pictures. When posting via Ecto I now use the URL of images that I put on my FTP server before. Cyberduck is a great tool for this and allows to easily copy the URL of any file on a FTP Server.


Applescript to translate a markdown file into a textile file (for later use in Textpattern)
18 September 2011

Ever since I started using Writing Kit I wondered if there would be an easy way to transform its output (which is in Markdown) to Textile. Textile is the markup language used by Textpattern – which this site runs on. Also I’m much more used to it.

The following script will translate a selected Markdown file (sorry, only one) into a textile file with an “.textile” extension. To run this script you need to have Pandoc installed.

tell application "Finder"
set theItems to selection
set fileName to name of item 1 of theItems as text
set fileFolder to folder of item 1 of theItems as text
set folderPos to POSIX path of fileFolder
end tell

set pdCall to "/usr/local/bin/pandoc -f markdown -t textile "
set pdCall to pdCall & quoted form of folderPos
set pdCall to pdCall & quoted form of fileName
set pdCall to pdCall & " -o " & quoted form of folderPos & quoted form of fileName & ".textile"

do shell script pdCall

I use this script in conjunction with Spark, in order to start it with a keyboard shortcut.

ps. Learning a bit of Applescript has been the true value of this exercise for me.


Textexpander snippets to pull frontmost Safari or Chrome webpage title and URL
15 September 2011

Inspired by an (Applescript) Textexpander snippet of Dr.Drang I created two snippets to make linking to a page a little easier for me.

First we need this snippet/script, called !furl, to pull the URL from Safari or Chrome:

tell application "System Events"
set numSafari to count (every process whose name is "Safari")
set numChrome to count (every process whose name is "Google Chrome")
end tell

if numSafari > 0 then
tell application "Safari" to get URL of front document
else
if numChrome > 0 then
tell application "Google Chrome"
set frontIndex to active tab index of front window
get URL of tab frontIndex of front window
end tell
end if
end if

(via furl at master from drdrang/te-url-snippets – GitHub)

And this one, called !fname, to pull the title from the frontmost webpage:

tell application "System Events"
set numSafari to count (every process whose name is "Safari")
set numChrome to count (every process whose name is "Google Chrome")
end tell

if numSafari > 0 then
tell application "Safari" to get name of front document
else
if numChrome > 0 then
tell application "Google Chrome"
set frontIndex to active tab index of front window
get name of tab frontIndex of front window
end tell
end if
end if

Now these snippets can be used, for example, to create links for Twitter with this snippet:

%snippet:!fname% %snippet:!furl%

or to create a proper blockquote (I use Textpattern, therefore this is a Textile) blockquote). Note that you have to select and copy the text that you want to show up in the blockquote first:

bq. %clipboard

(via "%snippet:!fname%":%snippet:!furl%)


Lion rant
24 Juli 2011

Not everything is bad in Lion but:

[Update 25. Juli 2011]


Byword and QuickCursor
4 Mai 2011

Just learned about Byword and QuickCursor and this blog post is one of my first attempts using it.1 I experienced so many issues during my first few days of trying that I won’t recommend this setting for productive work.

1 Using a Byword, QuickCursor and nvALT combination.


nvALT2 ftw!
17 April 2011


After weeks of anxious waiting nvALT 2 has finally come out and what a fine piece of software this thing has become… The three things I like most about this version:

1. Preview with custom.css: If you know how to type in textile or multimarkdown nvALT lets you preview a compiled version of your document (this feature was already included in earlier versions and is really just a keystroke away). The new version allows you to add a custum.css file and now everything I type here looks like a real lihai.de post in the preview.

2. OpenMeta support with autocompletion: Every note now can have its own OpenMeta tags. OpenMeta was added already earlier in the original Notational Velocity project of which nvALT is a fork. nvALT adds the autocompletion/suggestion feature.1

3. Support for nv-references: Like in the original Notational Velocity, nvALT now supports nv-urls.


1 Really looking forward to use this with Leap.


safari reader hack
5 April 2011


Inspired by this and that I decided to do my own Safari Reader UI hack.

Reader.html

ps. Brett Terpstra has a nice how-to install Safari Reader hacks.

[Update 2011_08_28: Under Safari 5.1 reader.html has moved to: /System/Library/PrivateFrameworks/Safari.framework/Versions/A/Resources/Reader.html]


ipad productivity/science apps - a list of recommendations
19 März 2011

This list is by no means complete and might be updated in the future.

Update 23. April 2011

- Although simplenote provides a great environment for sharing notes, I have switched to a different system. In the advent of nvALT 2, with its built in OpenMeta support, I finally made the switch to a Dropbox / textfile based solution. In the end simplenote was replaced by PlainText. I also tried Notesy and Neboulous but did not like what I found there…

- Recently I’m amazed by PDF expert. Soo much better than iAnnotate and GoodReader (user-friendly interface, highlighting works more reliable, export highlights to emails is a breeze too) and does include extra-features like a dropbox folder sync!

/Update

The Basics

- Simplenote (free)
Simplenote is my extended brain.

- Reeder (2,39€)
Simply the best App out there to read your RSS Feeds. Because of Reeder I preferred reading my Google Reader feeds on the iPad for quite a while. Only the new Reeder for Mac has changed this a bit.

- Instapaper (3,99€)
One of the best Apps for the iPad. A must.

- Dropbox (free)
The official client, not too bad.

- Good Reader (3,99€)
Everything file management (including FTP etc) plus reading. Very good value for little money.

- Articles (3,99€)
A beautiful wikipedia client.

Science

- Papers (11,99€)
Even without the Mac client software a great piece of software to find and organize articles from journals on the go. If you own a Mac and work in science this is a must.

- Mendeley (free)
A free alternative for Papers. It’s a cloud based service and besides the iPAd app there are clients for all desktop OS and even a website with the same functionality. Function-wise not at the same level as Papers.

- iAnnotate PDF (7,99€)
A not so beautiful GUI tries to mask the most powerful PDF tool for the iPad. Highlighting and annotations to PDF work great. The feature I like most: after you finished working on a PDF iAnnotate allows you to wrap all highlighted text into an email and send it to wherever you want it to. I use this with my Simplenote email address quite a lot.

- Sente
If you use Sente on the Mac this is probably a nice piece of software for you. The included cloud sync allows for instant access to all your references and PDFs everywhere. Still no annotation function and the desktop software has many quirky parts which annoy me.

Update Sente seems to have now a more complete iPad app. See here I haven’t tried this one (yet). (15,99€)

- Pleco (free+but some parts of the software are expensive add-ons)
Great software if you ever want to work with Chinese texts.

Data Buckets

I kind of stopped using data buckets and now work with a filing system along the lines of the one described in this article with an added layer of OpenMeta tags (hint: file naming conventions, Hazel, Tagger, Spark and Leap are important parts of this solution, which will be dealt with in a future blog post).

- Evernote
I tried to get into Evernote several times. In the end the paid solution is too expensive and the client software too ugly for my taste. Others might think differently, though.

- Yojimbo (7,99€)
Yojimbo on the Mac is very minimalistic and I really dig its ease of use. Adding tags is a breeze. However cloud sync is a pain and only works with a dropbox hack. In addition Yojimbo allows only for certain file types to be added. The iPad version is a little buggy and does not allow you to add new PDFs. Not overly happy with it.

- DevonThink to go (11,99€)
Haven’t tried this one, as I don’t use DevonThink. I know I probably should, but I simply can’t wrap my head around some design and GUI decisions of the desktop software (worst implementation of the tag-concept ever!).

Productivity

- 1Password (7,99€)
Great software that syncs with Dropbox. All passwords ready, in a safe and secure way.

- iA Writer (0,79€)
Minimalist writing software. I like using this to just get writing tasks done. Works nicely with any bluetooth keyboard.

- Omnifocus (31,99€)
Task management in the GTD fashion done professionally. I still use the iPhone version on my iPad, the iPad version is just soo expensive. However, many people swear by it and even call it magic.

- Things (15,99€)
Not as sophisticated as Omnifocus and lags a cloud sync option. It’s a beautiful piece of software, though.

- iThoughtsHD (7,99€) and MindNote (4,99€)
Nice software to create OPML mindmaps, which I end up using in Scrivener.

- Office2 HD (5,99€)
Software for editing Word and Google documents. Bought it, but never actually had a use case for it.

For more app inspiration you should turn to the MacSparky home screen series or Beautiful Pixels.


ältere Artikel...