How to run a Matlab code in a shell script

Examples of how to run a Matlab code in a shell script:

cd /the/path
matlab -nodesktop -nosplash -nojvm -r "my_matlab_file;exit;"

or

matlab -nodesktop -nosplash -nojvm -r "run /the/path/my_matlab_file.m;exit;"

Mendeley Word Citation Style for TRB Papers

Looking for a Mendeley citation style for TRB (Transportation Research Board)?
I have created one (trb.csl) by modifying one the exiting styles.

Installation

On a Mac, copy the file in  /Applications/Mendeley Desktop.app/Contents/Resources/citationStyles-1.0

(see Mendeley tutorial for instructions)

Remote desktop from Mac osx to Windows

To access your Windows desktop from a Mac, all you need is a VNC server on the Windows machine and a VNC client on the Mac. A free solution would be:
- Run TightVNC Server on the Windows
* set a strong password
- Run JollysFastVNC on the Mac
* create a new connection, and use the IP address of the Windows machine and the same password  used to install the TightVNC server.

- Done.

ssh Warning: the RSA host key for differs from the key for the IP address

To get rid of this message:

ssh Warning: the RSA host key for differs from the key for the IP address

remove the line causing the problem from file ~/.ssh/known_hosts  (read  Rob’s comment on this)

Matlab installation problem on Snow Leopard

Problem:
When you are installing Matlab R2009a on Snow Leopard you might get the error: Can’t load library: /Applications/MATLAB_R2009a.app/bin/maci64
Solution:
- use finder to find Java preferences
- drag the 32 bits item and drop it before the 64bit
- run Matlab and complete the activation
- (at the end you can restore the default setting for Java preferences)

Reference: 1


How to introduce sty files to LaTeX in Linux

First put your sty files in /usr/local/share/texmf/ or your own subdirectory e.g. /usr/local/share/texmf/foo and run sudo texhash

Install Swiftfox with Flash for Ubuntu 9.0, 64 bits

Download Swiftfox from here

sudo sh install-swiftfox.sh
To get Flash running:

mkdir ~/.mozilla/plugins  (if it does not exist)

sudo aptitude install nspluginwrapper   (to be able to handle the 32-bit Flash player)

download Flash (.tar.gz) from here
unzip and move libflashplayer.so into the ~/.mozilla/plugins directory
restart Swiftfox

Headphone fix for Ubuntu 9.04 on Sony Vaio

The Problem : The headphone / earphone jack is being ignored by Ubuntu 9.04 on the Sony Vaio VGN-FW11E. Sound continues to play through the lap-top speakers even when the headphone is plugged in.

The Solution: Edit the file /etc/modprobe.d/alsa-base.conf and include this line at the end:

options snd-hda-intel model=sony-assamd

Save the file and reboot your machine.
In case the problem still exists try this one:

options snd-hda-intel model=vaio

Wrong reference number in LaTeX

Be careful about the order of caption and label when you use them together for a figure in LaTeX. The caption has to come before the label, otherwise the compiler generates wrong numbers for all corresponding \refs. This is very confusing, isn’t it? I don’t know why the compiler is designed to be sensitive to such order?!

How I planned to write Master’s Thesis report

When I started writing my Master’s thesis report, I found it a tough task. Yes, I postponed the report until the end of the project ;) . I asked myself: what if writing a report was as fun as writing computer programs? why is that writing a report is so difficult. Finally, I came up with the idea of making a plan for writing. Something like a procedure or algorithm. It was really helpful and I really enjoyed writing the report.

Writing a report is difficult as long as you think of it as a task of creating a 50 or 100-page document. But instead, think of it as writing a signle paragraph? Isn’t it much easier? The idea is to break down the problem of “writing a report” to “writing  paragraphs”. You may call it a dynamic programming approach. So from now on,  you’re going to write a paragraph at a time not a full report.

If it is a scientific docutment, you may follow IMRAD structure. but what it gives you is breaking the document down to “Sections”. But a “Section” still is a big piece to write, and it gives you the same feeling as writing a full report! You have done a lot of work in the project but you don’t know from which point to start or where to put the stuff.

Let’s start the procedure:

Step 1. Determine number of paragraphs you would like to (or sometimes have to) write. Paragraphs are building blocks here. It would be good to have a rough gestimation of the number of paragraphs. How to find it?  from number of pages you have to write (usually maximum and minimum size of a report is specified otherwise you would better to do that for yourself). It helps you to know how much effort you have to put and , e.g. how many paragraphs per day you need to write to have the paper done before the deadline.

Step 2. Use a Lorem ipsum generator to build dummy paragraphs as many as you decided to write. Now, you may feel better by looking at something which looks like a report ;) . We are going to modify the content of paragraphs one by one until the report gets finished.

Step 3. At the beginning of each paragraph, write a sentence (put it in brackets). The sentence should remind you what the paragraph is about. It is actually the goal of the paragraph. You are going to keep this sentence until the final review of the report. Then it will be removed.

Try to think in higher level and not the details of each paragraph. The order of paragraphs is not important at this step. Just add whatever you think you need to write about. So at the end of this step, you have a portion of the paragraphs with “aims” but still dummy content. (take your time, no need to do all at once)

Step 4. It’s time to write the body of each paragraph. To make the writing easier you need to find out which “kind” of paragraph you are going to write; for example:

4.a If the paragraph is going to give a ‘definition’:
- read you notes or read some resources (if you haven’t) about the subject and understand it and write it in your own words. Sometimes it is good to bring the definition with original words and refer to its author.

4.b If the paragraph describes some related works from other authors:
- look at your notes you wrote during your literature study (so this means you need to take notes and organize your readings in some ways during literature study. I used citeulike for this purpose and found it very useful. [updated: switched to Mendeley after a year. You can connect it to Word or LaTeX.]
- Search for more articles if you think you have missed during your literature study.
- Write the paragraph about related works and put the references wherever needed. The bibliography section will be gradually completed while the report is being completed.
4.c If paragraph is about introducing other chapters:
- make a list of chapters and describe each one very briefly. But keep it short.
4.d Other types of paragraph ,et cetera, et cetera

Until now, you have prepared a draft version for each paragraph.

Step 5. Order the paragraphs and glue them together:
Although you have to have thought about the order of the paragraphs in advance, you still need to revise it when the report is being gradually completed.
The following is an example of ordering the paragraphs I used for (the introduction section of) my thesis report:
I. Description of the problem (from requirement to applications)
II. Why is the subject (which you are writing about) important?
III. What has been done by others in this field?
IV. What is your goal with the current work (your thesis project?)
V. How does your experiment differ from what has been done previously?
VI. What will be seen in the next sections of this report.
(Some parts of the paragraphs’ order are suggested by my supervisor, Mattias)

Step 6. Read your report a couple of times and revise it. If you have enough time, go back to the report after some days and review it, this gap lets your brain perform differently.

The “Abstract” and “Conclusion” can be the last sections that you take care of.

It’s all about visualizing the progress while writing. Again, this is based on my experience and it worked for me.

Follow

Get every new post delivered to your Inbox.