List sorted files/folder based on time or date

To list the files/folder sorted based on time, simply type
ls -lt
the -l is for “long” format display, and -t is to sort based on its “time”. to sort in reverse order, type
ls -lrt

Segmentation fault when using .oct function

I created my own function and compile it as .oct. But everytime I run it I got this error
octave:1> finvhalf
panic: Segmentation fault — stopping myself…
attempting to save variables to `octave-core’…
save to `octave-core’ complete
Segmentation fault
The thing is that the output does not really tell what is the error. The compilation was successful as well. It turns [...]

Octave C++ Quick Reference

I found the Octave Wiki which provides a quick reference how to port Octave code to its C++ using Octave’s library. But somehow, recently I can’t access the wiki. Luckily, I can still find it in the Google’s cache search.
You can see it here:
OctCppQuickRef.pdf
UPDATE:
Now I can access the page again. it’s here:
http://wiki.octave.org/wiki.pl?CPPQuickReference

Use fabs for getting the absolute from double

I am porting my Octave code to C++, somehow I always got zero for one expression that I calculate. After debugging, it turns out after I take abs(expression), the values always zero. Argh. I forgot, abs() in C++ is only for integer and long. I need to use fabs() for float or double. Now it [...]

how to create a package from svn (subversion) folder

After developing my code for quite sometime, now it is ready to release its 1.0 version.
svn export my-working-copy my-dest-folder
This copy action omit the “.svn” folder inside. So all the svn info is not copied. And then, just archive the folder as usual.
tar czvf yourpackage.tar.gz ./yourfolder
more info on svn export:
http://svnbook.red-bean.com/nightly/en/svn.ref.svn.c.export.html

1D Integration of discrete data with non-uniform grid spacing

Octave provides a simple function to do this integration even using non-uniform grid spacing: trapz(x,y)
http://octave.sourceforge.net/doc/f/trapz.html
A similar function exists in Matlab, Mathworks website gives more documentation on how to use it.

Writing mixed code Octave and C++

I need to speed up my Octave code, so I decided to port some of them to C++. The great things is that, it turns out not so difficult to port from the available octave code to C++. Octave provides the library to do matrix operations, vector, eigenvalue, linear algebra in C++ objects/functions.
For more info, [...]

Error in compiling Dynamically Linked Function (.oct files) in Octave

I tried to do the compilation suggested in Octave Manual:
http://www.network-theory.co.uk/docs/octave/octave_90.html
on the Dynamically Linked Function.
However , I got this error:
oregonator.cc: In function ‘octave_value_list Foregonator(const octave_value_list&, int)’:
oregonator.cc:7: error: conversion from ‘Array’ to non-scalar type ‘ColumnVector’ requested

There is a solution in the Octave forum here.
Basically we need to change this line
ColumnVector x = args(0).vector_value ();

to this one
ColumnVector [...]