emacs - replace numbers with calculated numbers

To replace numbers in a document with other calculated numbers (e.g. to replace a 20 with 20-10=10, and a 43 with 33), the best is to use

M-x query-replace-regexp

which is bound to

M-C-%  (= M-C-Shift-5).

Or use

M-x replace-regepx

E.g. to subtract 8 from each number in  the string

out_11_14Small.png

do the following:

M-x query-replace-regexp
[Query replace regexp:] \([0-9][0-9]\) RET
[Query replace regexp in region \([0-9][0-9\) with:]   \,(+ -8 \#1) RET

RET = press the return key.

Drupal - How to show content with the same tags below a menu tab

If you e.g. want to show all blog entries with the tag "bash" when clicking on the menu tab "bash", here is what you have to do.

Install following two modules:

ctools

views

and enable views, views ui and ctools.

go to
  structure > views > add new view

  View name: bash_view
  Show Content of type all tagged with YOUR-TAG sorted by Newest first  

matlab - How to use a struct in a mex file

It took me some time until I figured out how to pass a struct to a mex file and especially how to get out the values.

To get the values from the struct following lines are important:

 /* get the values from the struct */
  const mxArray  *mxTmp; 
  double         *tmp;
 
  mxTmp = mxGetField(prhs[1],0,"par1");
  tmp   = mxGetPr(mxTmp); 

Here the full code

Drupal - include code highlighting tools (google prettify) with CKEditor

This post explaines how to get highlighted code in Drupal 7 like:

for i = 1:3
   j = i;
end

For me the combination of CKEditor and the code highlighting tool Geshi did not work.

Hence I tried the combination of the module [[https://www.drupal.org/project/prettify | google code prettify]] (which is used by stackoverflow.com) and CKEditor.

Prerequisite

CKEditor must be installed. See other post for that.

Getting it to run

emacs - Replace regexp / string / words in several / multiple files

In short:

M-x dired-do-query-replace-regexp

 

Longer version:

To replace the same regexp, string or word in multiple files go into dired mode

C-x C-f RET

Then you should see a list of files.

 

Mark the files you want to edit with m.

To mark all files press t (M-x dired-toogle-marks).

matlab do not show any figures

Sometimes you don't want to display figures or plots within matlab, e.g. if running matlab with the -nodesktop flag on a remote machine, e.g.

matlab -nodesktop

Include following lines in your code or paste it in the matlab command window to disable the figures:

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

Sometimes it is also good to include

Pages