Wednesday, June 17, 2009

Grails : Create read only domain objects

When we use the get method, the object is loaded from the database in a modifiable state.
In other words, you can make changes to the object, which then get persisted to the database.
If you want to load an object in a read-only state, you can use the read method instead:

def album = Album.read(params.id)

In this case, the Album instance returned cannot be modified. Any changes you make to the
object will not be persisted.

Regards,
~~Amit Jain~~

Tuesday, June 2, 2009

Jquery : Load page at specific position

In our project, we needed to load a page if we get errors once form is submitted. So I used the href of an anchor tag which was a link with in page to the div I wanted to be on the top on page load.

< script type="text/javascript" src="jquery.js">< /script >

< a href="#status" id="linkWithInAPage">< /a>

< div id="status">
...
< /div>

< script>
jQuery(document).ready(function(){
window.location.href = jQuery("#linkWithInAPage").attr('href');
});
< /script>



Cheers!

~~Amit Jain~~
amitjain1982@gmail.com

Monday, June 1, 2009

A ScreenCast on Ubuntu : Software Installation process of XVIDCAP

For screencasts, xvidcap is a good choice. When I installed it using "apt-get install xvidcap", I couldn't record the screencast, xvidcap window used to disappear as soon as when clicked on record button, I used to get segmentation fault error, when output was sent to text file using "xvidcap > log.txt"
After spending long time on google, I found the following solution.

1. Don't use package manager to install XVIDCAP. Download the latest version from sourceforge.net. The latest available version is 1.1.7. Don't install the .deb it did not work for me. Install the tar.gz archive.

2. Make sure the the following libraries are installed on your machine
a. libglade2-dev
b. libxmu-dev
If they are not, install them using "sudo apt-get install libglade2-dev libxmu-dev"

3. Extract the downloaded archive file and run the following three commands, plz make sure that you are in the folder where you have extracted the archive :
a. ./configure
b. make
c. sudo make install (here you need to use the sudo because this command would install files in the src folder).

To run xvidcap, with audio enabled
xvidcap --audio true --file /home/amit/Desktop/tutorial.mpeg


Cheers!!

~~Amit Jain~~
amitjain1982@gmail.com