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

Another Summer Hiatus
23 August 2013


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.


Summer hiatus
27 September 2012






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


Experten
8 März 2012

So hatten die Experten beispielsweise das zweite iPad und das iPhone 4S als Enttäuschung bezeichnet – den Kunden war das egal.

Völlig unerklärlich.

(via Apple stellt das neue iPad vor – Unbedingt berühren – Digital – sueddeutsche.de)


Five Million Cars
26 Februar 2012

The number of Beijing cars finally broke the five-million mark last week. The slight glimmer of good news is that due to the license plate lottery that was put into effect early last year Beijing only added 173,000 cars to the road in 2011 (a drop from more than 700,000 in 2010), dramatically postponing the proposed date for hitting five million by nearly a year.

(via Five Million Cars and Counting | the Beijinger Blog | Beijing Traffic | Feb 26, 2012 | thebeijinger.com)


Cribs, Beijing Edition
26 Februar 2012

Ai Weiwei’s walled compound looks like a well-guarded fortress, with one minor incongruous detail. The prominent security camera on the wide street outside belongs to the Chinese authorities and is trained on the entrance so they can watch who comes to visit China’s most famous artist and political dissident.

(via At home: Ai Weiwei – FT.com)


"How (not) (?) to apply for a Chinese working visa in Bangkok"
26 Februar 2012

I´m back in good ©old Shenyang, after an intended 2 1/2 weeks vacation in Thailand that turned into almost one and a half months. Worse things can happen than being stranded in this wonderful country for a while, though. So just for the record, I´m not complaining here. Just telling the story why it took so long.

(via itinerant: How an intended 2 1/2 weeks vacation in Thailand turns into 1 1/2 months.)

A friend of mine struggles to apply for a working visa during Chinese New Year.


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.


Ever.
12 Februar 2012

McAfee, the security company, said that if any employee’s device was inspected at the Chinese border, it could never be plugged into McAfee’s network again. Ever. “We just wouldn’t take the risk,” said Simon Hunt, a vice president.

(via Electronic Security a Worry in an Age of Digital Espionage – NYTimes.com)


ältere Artikel...