Thursday, June 13, 2013

Emacs comment / uncomment region

Add to config file:

(defun uncomment-region (beg end)
  "Uncomment a region of text"
  (interactive "r")
  (comment-region beg end -1));

(global-set-key "\C-c;"      'comment-region)
(global-set-key "\C-c:"      'uncomment-region)

Emacs overwrite selection

add the line:
(delete-selection-mode 1)
to the file 
~/emacs.d/init.el

Thursday, June 6, 2013

Open Office protect cells

* Select all cells with Ctrl+A
* Format->Cell->Cell Protection, unprotect [all]
* Select the cells to protect
* Format->Cell->Cell Protection, protect
* Tools->Protect Document->Sheet

ImageJ out of memory fix

Solution 1:

run from console:

./jre/bin/java -Xmx512m -jar ij.jar 

for getting 512MB (for example). (Source: http://imagejdocu.tudor.lu/doku.php?id=faq:technical:how_do_i_increase_the_memory_in_imagej)

Solution 2:

 edit the

/usr/bin/imagej

run script OR find it with

$ whereis imagej

then modify the line

declare -i default_mem=768

with the desired memory in MB. Notice limitations depending on total RAM and 32/64 bit system. (Source: http://ubuntuforums.org/archive/index.php/t-1236001.html)

Wednesday, June 5, 2013

ImageJ save Raw

26.10.6Raw Data…

Saves the active image or stack as raw pixel data without a header. 8-bit images are saved as unsigned bytes, unsigned 16-bit images are saved as unsigned shorts and signed 16-bit images (e.g., FileOpen SamplesCT (420K, 16-bit DICOM)) are saved as signed shorts. 32-bit images are saved as floats and RGB images are saved in three bytes per pixel (24-bit interleaved) format. 16-bit and 32-bit (float) images are saved using big-endian byte order unless Export Raw in Intel Byte Order is checked in the EditOptionsInput/Output… dialog box. 
 
http://rsbweb.nih.gov/ij/docs/guide/146-26.html

Monday, June 3, 2013

CUDA nvcc

"A different solution to overcome startup delay by JIT while still allowing execution on newer GPUs is to specify multiple code instances, as in
nvcc x.cu -arch=compute_10 -code=compute_10,sm_10,sm_13
This command generates exact code for two Tesla variants, plus ptx code for use by JIT in case a next-generation GPU is encountered. nvcc organizes its device code in fatbinaries, which are able to hold multiple translations of the same GPU source code. At runtime, the CUDA driver will select the most appropriate translation when the device function is launched."

"...the virtual compute architecture should always be chosen as low as possible, thereby maximizing the actual GPUs to run on. The real sm architecture should be chosen as high as possible (assuming that this always generates better code), but this is only possible with knowledge of the actual GPUs on which the application is expected to run. As we will see later, in the situation of just in time compilation, where the driver has this exact knowledge: the runtime GPU is the one on which the program is about to be launched/executed."

http://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc