Tag Archives: Ubuntu

Using gedit for editing MATLAB script in Ubuntu

By default, gedit recognises *.m file as object-c file and this causes unwanted syntax highlighting in gedit.

There is a workaround to fix this. Note that if you update gedit or mime type sets that overwrite your modification and you need to this again afterward.

gedit uses mime type for text management and all rules can be found from

 

/usr/share/mime/packages/freedesktop.org.xml

 

Let’s open this file with sudo.

Looking for <mime-type type=”text/x-objcsrc”> and this mime-type is for object-c source code.

For some reason, *.m file is mapped as object-c file <glob pattern=”*.m”/>, just before <mime-type type=”text/x-ocaml”> line.

Let’s change <glob pattern=”*.m”/> to<glob pattern=”*.c”/> and save it.

Finally, the following command updates your modification and gedit will use Octave syntax that properly displays MATLAB script.

 

sudo update-mime-database /usr/share/mime

 

Give this try and let me know whether this works or not.

local time sync through LAN using ptpd on ubuntu.

Source from: http://www.theperfectarts.com/2009/11/how-to-change-timezone-on-linux-server/#.UtZ-ABXI9ok

You can change the time zone for your server by using following command.

root@admin[~]#date

Wed Nov 11 19:30:29 EST 2009

For example we are changing time zone  from EST to GMT.

root@admin[~]#ln -sf /usr/share/zoneinfo/GMT /etc/localtime

root@admin[~]#date

Using the above command make sure systems you want to sync have the same timezone before using ptpd.

 

Source from: http://dev.couchrausch.de/degenhard/setting-up-ptpd-in-a-local-lan/

This is a short tutorial on setting up the Precsision Time Protocol (PTP) in a local LAN to synchronize time between the conneted hosts.

PTP is in comparison to NTP designed for matching the timebase of local host regardless the actual real worlds time.
It measures the delay a messaege has to get from peer A to peer B and calulates the resulting offsets so A and B have the exact same timebase.
A video explaining very friendly how it works can be found here PTP Introduction.

We suppose that you are running two debian (or similar) hosts in a local LAN with subnet address 192.168.1.0.

First step is to disable the probably running NTP daemon.
sudo /etc/init.d/ntp stop
Then prevent it from starting again at boot time.
sudo update-rc.d -f ntp remove
Now get the ptpd package via apt-get:
sudo apt-get install ptpd

First you can test by starting ptpd on the commandline to see if all is working.
Choose the master and type:
ptpd -c -b eth0 -h -D

On the slaves use same command with the -g switch:
ptpd -c -g -b bond0 -h -D

It takes some seconds to start, but then you should see the slave starting to print stats.

To activate the daemon, so it starts at boot time edit the /etc/defaults/ptpd file.
Change
START_DAEMON=no to yes
and add the commandline switches to
PTPD_OPTS=”-b bond0 -h” for the master and
PTPD_OPTS=”-g -b bond0 -h” for the slaves.

that should be all you have to do.

 

 

Fixing “Unable to monitor filesystem” Dropbox issue on Ubuntu.

Source from: http://paulphilippov.blogspot.ch/2011/02/how-to-solve-dropbox-filesystem.html

Once Dropbox throws you an error that reads “Unable to monitor filesystem. Please run: echo 100000 | sudo tee /proc/sys/fs/inotify/max_user_watches and restart Dropbox to correct the problem.” you’d better adjust settings in a system config file, to keep changes after reboot.

Open system config (as superuser, of course) in your my favorite text editor:

$ sudo vi /etc/sysctl.conf

Add just one line of code to the end of the file:

fs.inotify.max_user_watches = 100000

Save the file (Shift-ZZ, if you are new to Vi).
Reboot computer to apply settings and restart Dropbox.