Thursday, January 31, 2013

sqldf on mac

On mac, this is needed, otherwise it would ask of x11

options(gsubfn.engine = "R")
library(sqldf)

not knowing why now.

Thursday, January 24, 2013

random seed in makefile

SEED := $(shell od -An -N2 -i /dev/random | tr -d ' ')

Monday, January 21, 2013

batch word to pdf

http://superuser.com/questions/17612/batch-convert-word-documents-to-pdfs-free

In particular, 

Save this to a file SaveAsPDF.js and run it from the command line using cscript.exe //nologo SaveAsPDF.js SomeFolder\MyDocToConvert.doc:

  var fso = new ActiveXObject("Scripting.FileSystemObject");  var docPath = WScript.Arguments(0);  docPath = fso.GetAbsolutePathName(docPath);    var pdfPath = docPath.replace(/\.doc[^.]*$/, ".pdf");  var objWord = null;    try  {      WScript.Echo("Saving '" + docPath + "' as '" + pdfPath + "'...");        objWord = new ActiveXObject("Word.Application");      objWord.Visible = false;        var objDoc = objWord.Documents.Open(docPath);        var wdFormatPdf = 17;      objDoc.SaveAs(pdfPath, wdFormatPdf);      objDoc.Close();        WScript.Echo("Done.");  }  finally  {      if (objWord != null)      {          objWord.Quit();      }  }