Tuesday, April 3, 2012

Useful for getting the Table View Cell height containing Text

-(CGFloat)labelHeightForText:(NSString *)text

{

   CGFloat constrainedSize = 231.0; //or any other size

   UIFont *font = [UIFont fontWithName:@"Helvetica" size:17.0];

   CGSize textSize = [text sizeWithFont:font 

                      constrainedToSize:CGSizeMake(constrainedSize, CGFLOAT_MAX)

                          lineBreakMode:UILineBreakModeWordWrap];

   return textSize.height;

}

Thursday, March 22, 2012

Script to delete .svn

find . -name ".svn" -type d -exec rm -rf {} \;

Friday, September 2, 2011

Fedora Installation

While installing Fedora by creating dual boot, you may get a error saying could not allocate space for requested partitions:not enough space left to create partition even when you have free 'unallocated space'.
Make sure that you can still create primary partitions (max. 4 primary partitions allowed). Create extended partition and create root, /boot partitions as logical partitions within that. (max. one extended partition allowed). If you already have a extended partition, create free space within that.

  • A swap partition (at least 256 MB) - Depending on RAM
  • /boot partition (250MB) - contains the operating system kernel (which allows your system to boot Fedora), along with files used during the bootstrap process.
  • root partition (3-5GB) - The / (or root) partition is the top of the directory structure.
 For more info on this
http://docs.fedoraproject.org/en-US/Fedora/13/html/Installation_Guide/s2-diskpartrecommend-x86.html

Thursday, July 28, 2011

Simple method to show/hide using javascript


  • Place this script at the beginning of the html code:

<script type="text/javascript">

function showhide(ThisObj)

{

      nav=document.getElementById(ThisObj);

      if(nav.style.display=="none")

          nav.style.display='block';

      else

          nav.style.display='none';

 }

</script>

  • Give a link (either a plus sign or some text or even a button) for the content to be shown or hidden:

<div onclick="showhide('step')" >link name</div>

  • The content to be shown or hidden (expanded) needs to be placed within this div tag:

<div id="step" style="display: none;"> content to be shown and hidden </div>

Thursday, July 14, 2011

Books on linux kernel hacking

few very good books I found on Kernel Hacking for start-ups:

learn about how to build, configure, install kernel:
Linux Kernel in a Nutshell, by Greg Kroah-Hartman, published by O'Reilly.
http://www.kroah.com/lkn/

learn about device drivers in detail:
Linux Device Drivers, by Jonathan Corbet, Alessandro Rubini, and Greg Kroah-Hartman, 3rd Edition, published by O'Reilly.
http://lwn.net/Kernel/LDD3/