How to install/upload a dokuwiki on a hosted server / webhost

  1. Create an account at a webhost. There are also free ones out there, e.g. cwcity.de, but then you get bombed with advertisement.
  2. Download Dokuwiki at http://download.dokuwiki.org/ and unzip it (on your local computer)
  3. Install a FTP client, e.g. the Firefox Addon "FireFTP" or the software "filezilla" or in Linux the file browser "nautilus".

bash - string / file name manipulation

In the following some useful bash snippets to manipulat strings / file names are listed.

Extract substrings

1. crop a consecutive substring ${string:position:length}

name=abcd123FGHI;
subStr=${name:4:3};
echo $subStr; # result is 123

2. remove beginning or end of a string

str=/path/to/my/file/123_complicated_9034.txt;

removes shortest matching suffix pattern %

Drupal 7: Do not count visits of bots or spammers

If you use the statistics module (in core in Drupal 7) to show how many times an article was read, there are two problems with that number

  1. also bots and spammers are count
  2. if you reload the page (e.g. with F5) the number is incremented

SOLUTION TO 1.

Browse to 

MYWEBISTE.com/admin/config/system/statistics

and check

safer use of the shell / terminal

I included following lines into my ~/.bashrc to have a more secure shell experience.

1) Do not remove (unlink) a file, but move it to the trash-can. You have to install trash-cli,
 

sudo apt-get install trash-cli
alias rm="echo 'NOTE: !! not removing, but moving to trash-can!! '; trash-put"

If you want to use the normal rm command, use

/bin/rm file1ToRemove.txt file2ToRemove.png

2) ask before overwriting a file, if you accidentaly copy or move a file with the same name.

Disable user registration in Drupal 7

If you have a simple side, where you don't want everybody to be able to register, especially not bots, you can only grant the administrator the rights to create new users. 

In Drupal 7, browse to

www.MYWEBSITE/admin/config/people/accounts

and set

Who can register accounts?

to

start matlab script from linux command line

If you want to start a matlab script from terminal (in linux or mac), you can use following command

matlab -nojvm -nodisplay -nosplash -r "addpath ('/path/to/script'), test_script(imgSize,'savepath'), exit"

Then matlab starts, executes the script and exits again.

test_script looks something like

function test_script(j,savepath)
img = rand(imgSize,imgSize);
imwrite(img, sprintf('%s/myTestImg.png',savepath),'png');
return

show no figures in matlab, disable figures

If you want to run a matlab script, that shows figures, on a remote machine without using ssh -X, start matlab with

matlab -nodesktop

and write following line in the matlab terminal, before starting your .m script

  set(0,'DefaultFigureVisible','off');

That prevents figures to pop up. To set the visibility on 'on', use

  set(0,'DefaultFigureVisible','on');

Pages