Thursday, October 30, 2014

R, packages and Rstudio install on Debian wheezy


See also my previous post on Debian GNU-Linux installation on a Lenovo T400.

R install

I used the Synaptic package manager to add the R repository for Debian from a nearby mirror, under : settings / repositories / other software / add.
Add this APT line:
deb http://cran.univ-paris1.fr/bin/linux/debian/ wheezy-cran3/

There was an error:
W: GPG error: http://cran.univ-paris1.fr wheezy-cran3/ Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 06F90DE5381BA480
After looking at several forums, and this stackoverflow question, I installed debian-keyring and added the key with the commands:
gpg --keyserver pgpkeys.mit.edu --recv-key 06F90DE5381BA480
gpg -a --export 06F90DE5381BA480 |sudo apt-key add -
I could then install R version 3 from the synaptic package manager.

Rstudio

I downloaded R-studio and installed it. There was a missing dependency for libjpeg62. I installed that package from Synaptic. Then ran the dpkg command to install rstudio.
dpkg -i rstudio-0.98.507-i386.deb

Tools

Then I installed Git in order to clone my R project from an online repository.
git clone  project_repository_url

Packages

Within Rstudio, I installed a few packages:
install.packages(c("plyr", "reshape2", "ggplot2"))
install.packages(c("xtable", "markdown", "devtools"))

devtools

The devtools packages requires a libcurl dev Debian package. You can install it at the shell prompt:
$ sudo apt-get install libcurl4-gnutls-dev
Back at the R prompt
install.packages("devtools")
Other dependencies might be needed, the RStudio page on devtools recommends installing the Debian package r-base-dev.

dplyr

The dplyr package required the latest version of a Rcpp package. Which was not available on my CRAN mirror. I installed it from source, (based on this message):
install.packages("Rcpp", type = "source")
install.packages("dplyr")

xlsx

The xlsx package installation complained:
configure: error: Cannot compile a simple JNI program. See config.log for details.
Make sure you have Java Development Kit installed and correctly registered in R.
If in doubt, re-run "R CMD javareconf" as root.


Required the latest version of java 7. (inspired by this post). I installed openjdk-7 from the synaptic package manager. Then ran

update-alternatives --config java  # Choose java 7 as the default
R CMD javareconf
Then
install.packages("xlsx") # worked

RMySQL

MySQL client and server are installed on my system.
While installing RMySQL, I struggled with a configuration error:
  could not find the MySQL installation include and/or library
  directories.  Manually specify the location of the MySQL
  libraries and the header files and re-run R CMD INSTALL.
This post has an answer (thanks!):
sudo apt-get install libdbd-mysql  libmysqlclient-dev
That fixes the issue!
I can connect to the database
library(RMySQL)
mychannel <- br="" dbconnect="" host="localhost" user="paul" ysql="">                       password="***", dbname="dbname")

R packages which are better installed from the Debian package manager

Some packages, such as ‘minqa’, ‘SparseM’ and ‘car’ return an error when one tries to install them from the R prompt. The can only be installed from the Debian package manager, where they have names starting with "r-cran": "r-cran-car", "r-cran-sparsem", "r-cran-minqa".

Ready to work!


Thursday, October 09, 2014

Email backup from Microsoft Outlook to Tunderbird / Icedove under Debian

To read an outlook email archive, .pst file, on a Debian system:
  1. On the windows system in Thunderbird, I imported
  2. In Debian I accessed it from Icedove, (the rebranded thunderbird)

1. In Windows 

There was an error in the 3.9 GB pst file created in September 2014.

scanpst.exe

As explained on microsoft support, I tried to use the inbox repair tool: scanpst.exe It has found errors in the file I have asked it to repair the file. It copied the whole content in a backup file .bak. It created a log file and it corrected the archive. I could open it in Outllook, under file / data file management. I compacted the archive, it's now 3.7 Gb in size. I closed Outlook and put it in my online backup folder.

Thunderbird

To be able to access this mail archive under Linux.  I followed a Mozilla article which recommends to import outlook mail (including the .pst file) in Thunderbirdwith the menu:
Tools  / Import /   mail
Thunderbird can only open .pst archive files on a windows machine which has outlook installed. Then I closed Thunderbird and copied the file found under.

2. In Debian 

Icedove

I installed icedove from the synaptic package manager. I started it and closed it again. This created a directory in my home folder: .icedove, this is where I'll paste the Thunderbird backup.
Mozilla's explanation on how to restore Thunderbird backup :
  1. Locate the backed up profile folder on your hard drive or backup medium (e.g., your USB-stick).
  2. Open the profile folder backup (e.g., the xxxxxxxx.default backup).
  3. Copy the entire contents of the profile folder backup, such as the mimeTypes.rdf file, prefs.js file, bookmarkbackups folder, etc.
  4. Locate and open the new profile folder as explained above and then close icedove (if open).
  5. Paste the contents of the backed up profile folder into the new profile folder, overwriting existing files of the same name.
  6. Start Icedove.

Online data storage with mono /usr/lib/hubic/hubiC.exe main-loop

List of online content delivery platforms in French

I am testing Hubic, a French online storage service. I installed it on GNU-Linux, it's actually using a windows like executable through mono, the process running is the following:
mono /usr/lib/hubic/hubiC.exe main-loop

To show or sets current synchronization directory:
hubic syncdir
To print some information about account and running operations.
hubic status
To show options
hubic config
To set the option time between Synchronization
hubic config TimeBetweenSynchronization 30

Sunday, October 05, 2014

Create Ubuntu unity Launcher for the wine program irfanview


Irfanview was installed using the winetricks program, which requires to load an older version 4.33 found on oldapps.com
Then I created a launcher called  "irfanview.desktop" :
[Desktop Entry]
Type=Application
Name=Irfanview Program Loader
Exec=wine /home/paul/.local/share/wineprefixes/irfanview/drive_c/Program\ Files\ \(x86\)/IrfanView/i_view32.exe
MimeType=application/x-ms-dos-executable;application/x-msi;application/x-ms-shortcut;
Icon=/home/paul/.local/share/applications/irfanview.png
NoDisplay=true
StartupNotify=true
This launcher is a .desktop file based on an askubuntu answer which starts by suggesting to copy an existing .desktop file from :
ls /usr/share/applications/*.desktop
I copied the wine launcher.
I changed the image based on this Ubuntu Handbook post.

Right click menu "open with"

It's also possible to edit context menus. I tried editing: "/home/paul/.local/share/applications/wine-extension-jpe.desktop"

I replaced the line starting with Exec by the following:

Exec=env WINEPREFIX="/home/paul/.local/share/wineprefixes/irfanview" wine start /ProgIDOpen IrfanView %f
I adapted the exec command from this message.
Now when I right click on a JPEG image, open with / Irfanview. Irfanview starts with the image open.

Associate as default application

May require to edit this file:
/usr/share/gnome/applications/defaults.list
 And this page recomments to add a mime type in the folder:
/usr/share/mimelnk/application/