Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@Hlynsson
Hlynsson / gist:a05cbeb670bdb6b31f730f7ed04123d2
Last active February 28, 2018 22:42
Virtual Box compile on Windows 7
Used https://www.paperspace.com standard machine: 8GB RAM, 4 x CPU, 512 MB GPU, 50GB SSD. Windows 7. Running as Windows Server 2008 in desktop mode
Installed all Windows updates and restarted
Following https://www.virtualbox.org/wiki/Windows%20build%20instructions
Visit https://www.visualstudio.com/vs/older-downloads/ for VC++ 2010 via login to live.
Downloaded Visual Studio Test Professional 2010 web installer (exe)
Custom install for Visual C++, Visual C# and Graphics Libraries only
Started Visual Studio to make sure it launches okay
Restart. Windows pulls some extra patches -> Restart again.
Microsoft Windows SDK for Windows 7 and .NET Framework 4 - Web installer complains about .NET 4 RTM version and that it will skip installs so went with offline DVD https://www.microsoft.com/en-us/download/details.aspx?id=8442 -> GRMSDKX_EN_DVD.iso
Uninstall .NET
> rm(list=ls())
> someFunction <- function(x) { return(x*someVariable) }
> invisible(compiler::cmpfun(someFunction))
Note: no visible binding for global variable 'someVariable'
# Scoping can be an issue:
> someVariable <- 1
> invisible(compiler::cmpfun(someFunction))
# No more error because of lexical scope, to solve:
> poorMansLibrary <- new.env()
> poorMansLibrary$someFunction <- someFunction
hansi@Hansi:~$ echo "something <- 1:5;save(something,file=\"something.RData\",compress=\"xz\");rm(something);load(‌​\"something.RData\");print(something)" > script.r
hansi@Hansi:~$ Rscript "script.r" > out
hansi@Hansi:~$ cat out
[1] 1 2 3 4 5