<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-7632507032661921953</id><updated>2012-02-16T03:32:42.223-08:00</updated><category term='blogger'/><category term='blog'/><category term='spam'/><category term='google'/><title type='text'>My Thoughts</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://thoughtsattheworld.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7632507032661921953/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://thoughtsattheworld.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Shyam</name><uri>http://www.blogger.com/profile/08673908243392570530</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>30</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7632507032661921953.post-7453032751326686844</id><published>2009-04-15T10:39:00.000-07:00</published><updated>2009-04-15T10:40:34.120-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='blogger'/><category scheme='http://www.blogger.com/atom/ns#' term='spam'/><category scheme='http://www.blogger.com/atom/ns#' term='google'/><title type='text'>Spam Blog</title><content type='html'>Google detected that this is a spam blog? Could not really believe it since it has so few posts :))&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;But lets see what their review says! I am open for review!&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7632507032661921953-7453032751326686844?l=thoughtsattheworld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thoughtsattheworld.blogspot.com/feeds/7453032751326686844/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thoughtsattheworld.blogspot.com/2009/04/spam-blog.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7632507032661921953/posts/default/7453032751326686844'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7632507032661921953/posts/default/7453032751326686844'/><link rel='alternate' type='text/html' href='http://thoughtsattheworld.blogspot.com/2009/04/spam-blog.html' title='Spam Blog'/><author><name>Shyam</name><uri>http://www.blogger.com/profile/08673908243392570530</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7632507032661921953.post-6166289752431955012</id><published>2009-04-15T10:36:00.000-07:00</published><updated>2009-04-15T10:38:14.740-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='blog'/><category scheme='http://www.blogger.com/atom/ns#' term='spam'/><category scheme='http://www.blogger.com/atom/ns#' term='google'/><title type='text'>Blogger Import</title><content type='html'>I am trying to classify my blogs and hence created a new blog. I moved my blog from another account into this one and to my surprise, Google actually thought this is a spam blog. lets see how this goes further :)&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Anyways a nice spot for blogging, I am surprised that Thoughts At The World was available in blogger http://thoughtsattheworld.blogspot.com/&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7632507032661921953-6166289752431955012?l=thoughtsattheworld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thoughtsattheworld.blogspot.com/feeds/6166289752431955012/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thoughtsattheworld.blogspot.com/2009/04/blogger-import.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7632507032661921953/posts/default/6166289752431955012'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7632507032661921953/posts/default/6166289752431955012'/><link rel='alternate' type='text/html' href='http://thoughtsattheworld.blogspot.com/2009/04/blogger-import.html' title='Blogger Import'/><author><name>Shyam</name><uri>http://www.blogger.com/profile/08673908243392570530</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7632507032661921953.post-4716859179535702160</id><published>2005-12-04T15:33:00.000-08:00</published><updated>2009-04-15T10:34:06.685-07:00</updated><title type='text'>Convert All files in a directory</title><content type='html'>find ./*.ppm -exec convert {} {}.jpg \;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7632507032661921953-4716859179535702160?l=thoughtsattheworld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thoughtsattheworld.blogspot.com/feeds/4716859179535702160/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thoughtsattheworld.blogspot.com/2005/12/convert-all-files-in-directory.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7632507032661921953/posts/default/4716859179535702160'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7632507032661921953/posts/default/4716859179535702160'/><link rel='alternate' type='text/html' href='http://thoughtsattheworld.blogspot.com/2005/12/convert-all-files-in-directory.html' title='Convert All files in a directory'/><author><name>Shyam</name><uri>http://www.blogger.com/profile/08673908243392570530</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7632507032661921953.post-4402773970765568876</id><published>2005-11-30T06:14:00.000-08:00</published><updated>2009-04-15T10:34:06.685-07:00</updated><title type='text'>LZW Encoding Scheme C++</title><content type='html'>/********************************************************************&lt;br /&gt;**&lt;br /&gt;** Copyright (c) 1989 Mark R. Nelson&lt;br /&gt;**&lt;br /&gt;** LZW data compression/expansion demonstration program.&lt;br /&gt;**&lt;br /&gt;** April 13, 1989&lt;br /&gt;**&lt;br /&gt;*****************************************************************************/&lt;br /&gt;#include &lt;stdio.h&gt;&lt;br /&gt;#include &lt;stdlib.h&gt;&lt;br /&gt;#include &lt;string.h&gt;&lt;br /&gt;#include &lt;fstream.h&gt;&lt;br /&gt;&lt;br /&gt;#define BITS 14                   /* Setting the number of bits to 12, 13*/&lt;br /&gt;#define HASHING_SHIFT BITS-8      /* or 14 affects several constants.    */&lt;br /&gt;#define MAX_VALUE (1 &lt;&lt; BITS) - 1 /* Note that MS-DOS machines need to   */&lt;br /&gt;#define MAX_CODE MAX_VALUE - 1    /* compile their code in large model if*/&lt;br /&gt;                                  /* 14 bits are selected.               */&lt;br /&gt;#if BITS == 14&lt;br /&gt;  #define TABLE_SIZE 18041        /* The string table size needs to be a */&lt;br /&gt;#endif                            /* prime number that is somewhat larger*/&lt;br /&gt;#if BITS == 13                    /* than 2**BITS.                       */&lt;br /&gt;  #define TABLE_SIZE 9029&lt;br /&gt;#endif&lt;br /&gt;#if BITS &lt;= 12&lt;br /&gt;  #define TABLE_SIZE 5021&lt;br /&gt;#endif&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;int *code_value;                  /* This is the code value array        */&lt;br /&gt;unsigned int *prefix_code;        /* This array holds the prefix codes   */&lt;br /&gt;unsigned char *append_character;  /* This array holds the appended chars */&lt;br /&gt;unsigned char decode_stack[4000]; /* This array holds the decoded string */&lt;br /&gt;&lt;br /&gt;/********************************************************************&lt;br /&gt;**&lt;br /&gt;** This program gets a file name from the command line.  It compresses the&lt;br /&gt;** file, placing its output in a file named test.lzw.  It then expands&lt;br /&gt;** test.lzw into test.out.  Test.out should then be an exact duplicate of&lt;br /&gt;** the input file.&lt;br /&gt;**&lt;br /&gt;*************************************************************************/&lt;br /&gt;&lt;br /&gt;void output_code(FILE *output,unsigned int code);&lt;br /&gt;void compress(FILE *input,FILE *output);&lt;br /&gt;int find_match(int hash_prefix,unsigned int hash_character);&lt;br /&gt;void expand(FILE *input,FILE *output);&lt;br /&gt;unsigned char *decode_string(unsigned char *buffer,unsigned int code);&lt;br /&gt;unsigned int input_code(FILE *input);&lt;br /&gt;&lt;br /&gt;int main(int argc, char *argv[])&lt;br /&gt;{&lt;br /&gt;  FILE *input_file;&lt;br /&gt;  FILE *output_file;&lt;br /&gt;  FILE *lzw_file;&lt;br /&gt;  char input_file_name[81];&lt;br /&gt;  &lt;br /&gt;/*&lt;br /&gt;**  The three buffers are needed for the compression phase.&lt;br /&gt;*/&lt;br /&gt;  code_value=( int*)malloc(TABLE_SIZE*sizeof(unsigned int));&lt;br /&gt;  prefix_code=(unsigned int*)malloc(TABLE_SIZE*sizeof(unsigned int));&lt;br /&gt;  append_character=(unsigned char*)malloc(TABLE_SIZE*sizeof(unsigned char));&lt;br /&gt;  if (code_value==NULL || prefix_code==NULL || append_character==NULL)&lt;br /&gt;  {&lt;br /&gt;    printf("Fatal error allocating table space!\n");&lt;br /&gt;    exit(1);&lt;br /&gt;  }&lt;br /&gt;/*&lt;br /&gt;** Get the file name, open it up, and open up the lzw output file.&lt;br /&gt;*/&lt;br /&gt;  if (argc&gt;1)&lt;br /&gt;    strcpy(input_file_name,argv[1]);&lt;br /&gt;  else&lt;br /&gt;  {&lt;br /&gt;    printf("Input file name? ");&lt;br /&gt;    scanf("%s",input_file_name);&lt;br /&gt;  }&lt;br /&gt;  input_file=fopen(input_file_name,"rb");&lt;br /&gt;  lzw_file=fopen("test.lzw","wb");&lt;br /&gt;  if (input_file==NULL || lzw_file==NULL)&lt;br /&gt;  {&lt;br /&gt;    printf("Fatal error opening files.\n");&lt;br /&gt;    exit(1);&lt;br /&gt;  };&lt;br /&gt;/*&lt;br /&gt;** Compress the file.&lt;br /&gt;*/&lt;br /&gt;  compress(input_file,lzw_file);&lt;br /&gt;  fclose(input_file);&lt;br /&gt;  fclose(lzw_file);&lt;br /&gt;  free(code_value);&lt;br /&gt;/*&lt;br /&gt;** Now open the files for the expansion.&lt;br /&gt;*/&lt;br /&gt;  lzw_file=fopen("test.lzw","rb");&lt;br /&gt;  output_file=fopen("test.out","wb");&lt;br /&gt;  if (lzw_file==NULL || output_file==NULL)&lt;br /&gt;  {&lt;br /&gt;    printf("Fatal error opening files.\n");&lt;br /&gt;    exit(1);&lt;br /&gt;  };&lt;br /&gt;/*&lt;br /&gt;** Expand the file.&lt;br /&gt;*/&lt;br /&gt;  expand(lzw_file,output_file);&lt;br /&gt;  fclose(lzw_file);&lt;br /&gt;  fclose(output_file);&lt;br /&gt;&lt;br /&gt;  free(prefix_code);&lt;br /&gt;  free(append_character);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;/*&lt;br /&gt;** This is the compression routine.  The code should be a fairly close&lt;br /&gt;** match to the algorithm accompanying the article.&lt;br /&gt;**&lt;br /&gt;*/&lt;br /&gt;&lt;br /&gt;void compress(FILE *input,FILE *output)&lt;br /&gt;{&lt;br /&gt;  unsigned int next_code;&lt;br /&gt;  unsigned int character;&lt;br /&gt;  unsigned int string_code;&lt;br /&gt;  unsigned int index;&lt;br /&gt;  int i;&lt;br /&gt;  int t;&lt;br /&gt;  next_code=256;              /* Next code is the next available string code*/&lt;br /&gt;  for (i=0;i&lt;TABLE_SIZE;i++)  /* Clear out the string table before starting */&lt;br /&gt;    code_value[i]=-1;&lt;br /&gt;&lt;br /&gt;  i=0;&lt;br /&gt;  printf("Compressing...\n");&lt;br /&gt;  ifstream file("ratios");&lt;br /&gt;  file &gt;&gt; t;&lt;br /&gt;  string_code=t;&lt;br /&gt;/*&lt;br /&gt;** This is the main loop where it all happens.  This loop runs util all of&lt;br /&gt;** the input has been exhausted.  Note that it stops adding codes to the&lt;br /&gt;** table after all of the possible codes have been defined.&lt;br /&gt;*/&lt;br /&gt;  &lt;br /&gt;  //732 * 1214&lt;br /&gt;//while ((character=getc(input)) != (unsigned)EOF)&lt;br /&gt;  for(i=0;i&lt;732*1214-1;i++)&lt;br /&gt;    {&lt;br /&gt;      file &gt;&gt; t; character =t;&lt;br /&gt;      if (++i==1000)                         /* Print a * every 1000    */&lt;br /&gt; {                                      /* input characters.  This */&lt;br /&gt;   i=0;                                 /* is just a pacifier.     */&lt;br /&gt;   printf("*");&lt;br /&gt; }&lt;br /&gt;      index=find_match(string_code,character);/* See if the string is in */&lt;br /&gt;      if (code_value[index] != -1)            /* the table.  If it is,   */&lt;br /&gt; string_code=code_value[index];        /* get the code value.  If */&lt;br /&gt;      else                                    /* the string is not in the*/&lt;br /&gt; {                                       /* table, try to add it.   */&lt;br /&gt;   if (next_code &lt;= MAX_CODE)&lt;br /&gt;     {&lt;br /&gt;       code_value[index]=next_code++;&lt;br /&gt;       prefix_code[index]=string_code;&lt;br /&gt;       append_character[index]=character;&lt;br /&gt;     }&lt;br /&gt;   output_code(output,string_code);  /* When a string is found  */&lt;br /&gt;   string_code=character;            /* that is not in the table*/&lt;br /&gt; }                                   /* I output the last string*/&lt;br /&gt;    }                                     /* after adding the new one*/&lt;br /&gt;/*&lt;br /&gt;** End of the main loop.&lt;br /&gt;*/&lt;br /&gt;  output_code(output,string_code); /* Output the last code               */&lt;br /&gt;  output_code(output,MAX_VALUE);   /* Output the end of buffer code      */&lt;br /&gt;  output_code(output,0);           /* This code flushes the output buffer*/&lt;br /&gt;  printf("\n");&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;/*&lt;br /&gt;** This is the hashing routine.  It tries to find a match for the prefix+char&lt;br /&gt;** string in the string table.  If it finds it, the index is returned.  If&lt;br /&gt;** the string is not found, the first available index in the string table is&lt;br /&gt;** returned instead.&lt;br /&gt;*/&lt;br /&gt;&lt;br /&gt;int find_match(int hash_prefix,unsigned int hash_character)&lt;br /&gt;{&lt;br /&gt;int index;&lt;br /&gt;int offset;&lt;br /&gt;&lt;br /&gt;  index = (hash_character &lt;&lt; HASHING_SHIFT) ^ hash_prefix;&lt;br /&gt;  if (index == 0)&lt;br /&gt;    offset = 1;&lt;br /&gt;  else&lt;br /&gt;    offset = TABLE_SIZE - index;&lt;br /&gt;  while (1)&lt;br /&gt;  {&lt;br /&gt;    if (code_value[index] == -1)&lt;br /&gt;      return(index);&lt;br /&gt;    if (prefix_code[index] == hash_prefix &amp;&amp; &lt;br /&gt;        append_character[index] == hash_character)&lt;br /&gt;      return(index);&lt;br /&gt;    index -= offset;&lt;br /&gt;    if (index &lt; 0)&lt;br /&gt;      index += TABLE_SIZE;&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;/*&lt;br /&gt;**  This is the expansion routine.  It takes an LZW format file, and expands&lt;br /&gt;**  it to an output file.  The code here should be a fairly close match to&lt;br /&gt;**  the algorithm in the accompanying article.&lt;br /&gt;*/&lt;br /&gt;&lt;br /&gt;void expand(FILE *input,FILE *output)&lt;br /&gt;{&lt;br /&gt;  unsigned int next_code;&lt;br /&gt;  unsigned int new_code;&lt;br /&gt;  unsigned int old_code;&lt;br /&gt;  int character;&lt;br /&gt;  int counter;&lt;br /&gt;  unsigned char *string;&lt;br /&gt;  int t;&lt;br /&gt;  &lt;br /&gt;  ofstream file("output");&lt;br /&gt;  next_code=256;           /* This is the next available code to define */&lt;br /&gt;  counter=0;               /* Counter is used as a pacifier.            */&lt;br /&gt;  printf("Expanding...\n");&lt;br /&gt;&lt;br /&gt;  old_code=input_code(input);  /* Read in the first code, initialize the */&lt;br /&gt;  character=old_code;          /* character variable, and send the first */&lt;br /&gt;  &lt;br /&gt;  t=(unsigned char) old_code;&lt;br /&gt;  file &lt;&lt; t;&lt;br /&gt;  putc(old_code,output);       /* code to the output file                */&lt;br /&gt;  /*&lt;br /&gt;  **  This is the main expansion loop.  It reads in characters from the LZW file&lt;br /&gt;  **  until it sees the special code used to inidicate the end of the data.&lt;br /&gt;  */&lt;br /&gt;  while ((new_code=input_code(input)) != (MAX_VALUE))&lt;br /&gt;  {&lt;br /&gt;    &lt;br /&gt;    if (++counter==1000)   /* This section of code prints out     */&lt;br /&gt;    {                      /* an asterisk every 1000 characters   */&lt;br /&gt;      counter=0;           /* It is just a pacifier.              */&lt;br /&gt;      printf("*");&lt;br /&gt;    }&lt;br /&gt;/*&lt;br /&gt;** This code checks for the special STRING+CHARACTER+STRING+CHARACTER+STRING&lt;br /&gt;** case which generates an undefined code.  It handles it by decoding&lt;br /&gt;** the last code, and adding a single character to the end of the decode string.&lt;br /&gt;*/&lt;br /&gt;    if (new_code&gt;=next_code)&lt;br /&gt;    {&lt;br /&gt;      *decode_stack=character;&lt;br /&gt;      string=(unsigned char*)decode_string(decode_stack+1,old_code);&lt;br /&gt;    }&lt;br /&gt;/*&lt;br /&gt;** Otherwise we do a straight decode of the new code.&lt;br /&gt;*/&lt;br /&gt;    else&lt;br /&gt;      string=(unsigned char*)decode_string(decode_stack,new_code);&lt;br /&gt;/*&lt;br /&gt;** Now we output the decoded string in reverse order.&lt;br /&gt;*/&lt;br /&gt;    character=*string;&lt;br /&gt;    while (string &gt;= decode_stack)&lt;br /&gt;      {&lt;br /&gt; t=(unsigned char) *string;&lt;br /&gt; file &lt;&lt; t;&lt;br /&gt; putc(*string--,output);&lt;br /&gt;      }&lt;br /&gt;/*&lt;br /&gt;** Finally, if possible, add a new code to the string table.&lt;br /&gt;*/&lt;br /&gt;    if (next_code &lt;= MAX_CODE)&lt;br /&gt;    {&lt;br /&gt;      prefix_code[next_code]=old_code;&lt;br /&gt;      append_character[next_code]=character;&lt;br /&gt;      next_code++;&lt;br /&gt;    }&lt;br /&gt;    old_code=new_code;&lt;br /&gt;  }&lt;br /&gt;  printf("\n");&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;/*&lt;br /&gt;** This routine simply decodes a string from the string table, storing&lt;br /&gt;** it in a buffer.  The buffer can then be output in reverse order by&lt;br /&gt;** the expansion program.&lt;br /&gt;*/&lt;br /&gt;&lt;br /&gt;unsigned char *decode_string(unsigned char *buffer,unsigned int code)&lt;br /&gt;{&lt;br /&gt;int i;&lt;br /&gt;&lt;br /&gt;  i=0;&lt;br /&gt;  while (code &gt; 255)&lt;br /&gt;  {&lt;br /&gt;    *buffer++ = append_character[code];&lt;br /&gt;    code=prefix_code[code];&lt;br /&gt;    if (i++&gt;=4094)&lt;br /&gt;    {&lt;br /&gt;      printf("Fatal error during code expansion.\n");&lt;br /&gt;      exit(1);&lt;br /&gt;    }&lt;br /&gt;  }&lt;br /&gt;  *buffer=code;&lt;br /&gt;  return(buffer);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;/*&lt;br /&gt;** The following two routines are used to output variable length&lt;br /&gt;** codes.  They are written strictly for clarity, and are not&lt;br /&gt;** particularyl efficient.&lt;br /&gt;*/&lt;br /&gt;&lt;br /&gt;unsigned int input_code(FILE *input)&lt;br /&gt;{&lt;br /&gt;unsigned int return_value;&lt;br /&gt;static int input_bit_count=0;&lt;br /&gt;static unsigned long input_bit_buffer=0L;&lt;br /&gt;&lt;br /&gt;  while (input_bit_count &lt;= 24)&lt;br /&gt;  {&lt;br /&gt;    input_bit_buffer |= &lt;br /&gt;        (unsigned long) getc(input) &lt;&lt; (24-input_bit_count);&lt;br /&gt;    input_bit_count += 8;&lt;br /&gt;  }&lt;br /&gt;  return_value=input_bit_buffer &gt;&gt; (32-BITS);&lt;br /&gt;  input_bit_buffer &lt;&lt;= BITS;&lt;br /&gt;  input_bit_count -= BITS;&lt;br /&gt;  return(return_value);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void output_code(FILE *output,unsigned int code)&lt;br /&gt;{&lt;br /&gt;static int output_bit_count=0;&lt;br /&gt;static unsigned long output_bit_buffer=0L;&lt;br /&gt;&lt;br /&gt;  output_bit_buffer |= (unsigned long) code &lt;&lt; (32-BITS-output_bit_count);&lt;br /&gt;  output_bit_count += BITS;&lt;br /&gt;  while (output_bit_count &gt;= 8)&lt;br /&gt;  {&lt;br /&gt;    putc(output_bit_buffer &gt;&gt; 24,output);&lt;br /&gt;    output_bit_buffer &lt;&lt;= 8;&lt;br /&gt;    output_bit_count -= 8;&lt;br /&gt;  }&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7632507032661921953-4402773970765568876?l=thoughtsattheworld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thoughtsattheworld.blogspot.com/feeds/4402773970765568876/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thoughtsattheworld.blogspot.com/2005/11/lzw-encoding-scheme-c.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7632507032661921953/posts/default/4402773970765568876'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7632507032661921953/posts/default/4402773970765568876'/><link rel='alternate' type='text/html' href='http://thoughtsattheworld.blogspot.com/2005/11/lzw-encoding-scheme-c.html' title='LZW Encoding Scheme C++'/><author><name>Shyam</name><uri>http://www.blogger.com/profile/08673908243392570530</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7632507032661921953.post-3680515888353008386</id><published>2005-11-30T05:32:00.000-08:00</published><updated>2009-04-15T10:34:06.686-07:00</updated><title type='text'>Good Huffman Encoding Code Simple</title><content type='html'>#include &lt;iostream.h&gt;&lt;br /&gt;&lt;br /&gt;#include &lt;fstream.h&gt;&lt;br /&gt;#include &lt;vector.h&gt;&lt;br /&gt;#include &lt;stack.h&gt;&lt;br /&gt;#include &lt;string.h&gt;&lt;br /&gt;&lt;br /&gt;//&lt;br /&gt;// The node class is used to represent both leaf&lt;br /&gt;// and internal nodes. leaf nodes have 0s in the&lt;br /&gt;// child pointers, and their value member corresponds&lt;br /&gt;// to the character they encode.  internal nodes&lt;br /&gt;// don't have anything meaningful in their value&lt;br /&gt;// member, but their child pointers point to&lt;br /&gt;// other nodes.&lt;br /&gt;//&lt;br /&gt;&lt;br /&gt;using namespace std;&lt;br /&gt;struct node {&lt;br /&gt;    int weight;&lt;br /&gt;    unsigned char value;&lt;br /&gt;    const node *child0;&lt;br /&gt;    const node *child1;&lt;br /&gt;//&lt;br /&gt;// Construct a new leaf node for character c&lt;br /&gt;//&lt;br /&gt;    node( unsigned char c = 0, int i = -1 ) {&lt;br /&gt;        value = c;&lt;br /&gt;        weight = i;&lt;br /&gt;        child0 = 0;&lt;br /&gt;        child1 = 0;&lt;br /&gt;    }&lt;br /&gt;//&lt;br /&gt;// Construct a new internal node that has&lt;br /&gt;// children c1 and c2.&lt;br /&gt;//&lt;br /&gt;    node( const node* c0, const node *c1 ) {&lt;br /&gt;        value = 0;&lt;br /&gt;        weight = c0-&gt;weight + c1-&gt;weight;&lt;br /&gt;        child0 = c0;&lt;br /&gt;        child1 = c1;&lt;br /&gt;    }&lt;br /&gt;//&lt;br /&gt;// The comparison operator used to order the&lt;br /&gt;// priority queue.&lt;br /&gt;//&lt;br /&gt;    bool operator&lt;( const node &amp;a ) const {&lt;br /&gt;      return weight &lt; a.weight;&lt;br /&gt;    }&lt;br /&gt;  void traverse( string code = "" )  const;&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;//&lt;br /&gt;// The traverse member function is used to&lt;br /&gt;// print out the code for a given node.  It&lt;br /&gt;// is designed to print the entire tree if&lt;br /&gt;// called for the root node.&lt;br /&gt;//&lt;br /&gt;&lt;br /&gt;void node::traverse( string code ) const&lt;br /&gt;{&lt;br /&gt;  if ( child0 ) {&lt;br /&gt;    child0-&gt;traverse( code + "0" );&lt;br /&gt;    child1-&gt;traverse( code + "1" );&lt;br /&gt;  } else {&lt;br /&gt;    cout &lt;&lt; " " &lt;&lt; value &lt;&lt; "      ";&lt;br /&gt;    //cout &lt;&lt; setw( 2 ) &lt;&lt; weight;&lt;br /&gt;    cout &lt;&lt; "     " &lt;&lt; code &lt;&lt; endl;&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;//&lt;br /&gt;// This routine does a quick count of all the&lt;br /&gt;// characters in the input file.  I skip the&lt;br /&gt;// whitespace.&lt;br /&gt;//&lt;br /&gt;&lt;br /&gt;void count_chars( int *counts )&lt;br /&gt;{&lt;br /&gt;    for ( int i = 0 ; i &lt; 256 ; i++ )&lt;br /&gt;        counts[ i ] = 0;&lt;br /&gt;    ifstream file( "input.dat" );&lt;br /&gt;    if ( !file ) {&lt;br /&gt;        cerr &lt;&lt; "Couldn't open the input file!\n";&lt;br /&gt;        throw "abort";&lt;br /&gt;    }&lt;br /&gt;    file.setf( ios::skipws );&lt;br /&gt;    for ( ; ; ) {&lt;br /&gt;        unsigned char c;&lt;br /&gt;        file &gt;&gt; c;&lt;br /&gt;        if ( file )&lt;br /&gt;            counts[ c ]++;&lt;br /&gt;        else&lt;br /&gt;            break;&lt;br /&gt;   }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;    int counts[ 256 ];&lt;br /&gt;&lt;br /&gt;    count_chars( counts );&lt;br /&gt;    priority_queue&lt; vector&lt; node &gt;, vector&lt;node&gt; &gt; q;&lt;br /&gt;//&lt;br /&gt;// First I push all the leaf nodes into the queue&lt;br /&gt;//&lt;br /&gt;    for ( int i = 0 ; i &lt; 256 ; i++ )&lt;br /&gt;        if ( counts[ i ] )&lt;br /&gt;            q.push( node( i, counts[ i ] ) );&lt;br /&gt;//&lt;br /&gt;// This loop removes the two smallest nodes from the&lt;br /&gt;// queue.  It creates a new internal node that has&lt;br /&gt;// those two nodes as children. The new internal node&lt;br /&gt;// is then inserted into the priority queue.  When there&lt;br /&gt;// is only one node in the priority queue, the tree&lt;br /&gt;// is complete.&lt;br /&gt;//&lt;br /&gt;&lt;br /&gt;    while ( q.size() &gt; 1 ) {&lt;br /&gt;        node *child0 = new node( q.top() );&lt;br /&gt;        q.pop();&lt;br /&gt;        node *child1 = new node( q.top() );&lt;br /&gt;        q.pop();&lt;br /&gt;        q.push( node( child0, child1 ) );&lt;br /&gt;    }&lt;br /&gt;//&lt;br /&gt;// Now I dump the results&lt;br /&gt;//&lt;br /&gt;    cout &lt;&lt; "Char  Symbol   Code" &lt;&lt; endl;&lt;br /&gt;    q.top().traverse();&lt;br /&gt;    return 1;&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7632507032661921953-3680515888353008386?l=thoughtsattheworld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thoughtsattheworld.blogspot.com/feeds/3680515888353008386/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thoughtsattheworld.blogspot.com/2005/11/good-huffman-encoding-code-simple.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7632507032661921953/posts/default/3680515888353008386'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7632507032661921953/posts/default/3680515888353008386'/><link rel='alternate' type='text/html' href='http://thoughtsattheworld.blogspot.com/2005/11/good-huffman-encoding-code-simple.html' title='Good Huffman Encoding Code Simple'/><author><name>Shyam</name><uri>http://www.blogger.com/profile/08673908243392570530</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7632507032661921953.post-4421335635343997363</id><published>2005-11-30T04:03:00.000-08:00</published><updated>2009-04-15T10:34:06.686-07:00</updated><title type='text'>Debauchies Wavelets Good Sample Code</title><content type='html'>#include &lt;math.h&gt;&lt;br /&gt;#include &lt;iostream.h&gt;&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt;  &lt;p&gt;&lt;br /&gt;  Daubechies D4 wavelet transform (D4 denotes four coefficients)&lt;br /&gt;  &lt;/p&gt;&lt;br /&gt;  &lt;p&gt;&lt;br /&gt;  I have to confess up front that the comment here does not even come&lt;br /&gt;  close to describing wavelet algorithms and the Daubechies D4&lt;br /&gt;  algorithm in particular.  I don't think that it can be described in&lt;br /&gt;  anything less than a journal article or perhaps a book.  I even have&lt;br /&gt;  to apologize for the notation I use to describe the algorithm, which&lt;br /&gt;  is barely adequate.  But explaining the correct notation would take&lt;br /&gt;  a fair amount of space as well.  This comment really represents some&lt;br /&gt;  notes that I wrote up as I implemented the code.  If you are&lt;br /&gt;  unfamiliar with wavelets I suggest that you look at the bearcave.com&lt;br /&gt;  web pages and at the wavelet literature.  I have yet to see a really&lt;br /&gt;  good reference on wavelets for the software developer.  The best&lt;br /&gt;  book I can recommend is &lt;i&gt;Ripples in Mathematics&lt;/i&gt; by Jensen and&lt;br /&gt;  Cour-Harbo.&lt;br /&gt;  &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;  &lt;p&gt;&lt;br /&gt;  All wavelet algorithms have two components, a wavelet function and a&lt;br /&gt;  scaling function.  These are sometime also referred to as high pass&lt;br /&gt;  and low pass filters respectively.&lt;br /&gt;  &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;  &lt;p&gt;&lt;br /&gt;  The wavelet function is passed two or more samples&lt;br /&gt;  and calculates a wavelet coefficient.  In the case of&lt;br /&gt;  the Haar wavelet this is &lt;br /&gt;  &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;  &lt;pre&gt;&lt;br /&gt;  coef&lt;sub&gt;i&lt;/sub&gt; = odd&lt;sub&gt;i&lt;/sub&gt; - even&lt;sub&gt;i&lt;/sub&gt;&lt;br /&gt;  or &lt;br /&gt;  coef&lt;sub&gt;i&lt;/sub&gt; = 0.5 * (odd&lt;sub&gt;i&lt;/sub&gt; - even&lt;sub&gt;i&lt;/sub&gt;)&lt;br /&gt;  &lt;/pre&gt;&lt;br /&gt;  &lt;p&gt;&lt;br /&gt;  depending on the version of the Haar algorithm used.&lt;br /&gt;  &lt;/p&gt;&lt;br /&gt;  &lt;p&gt;&lt;br /&gt;  The scaling function produces a smoother version of the&lt;br /&gt;  original data.  In the case of the Haar wavelet algorithm&lt;br /&gt;  this is an average of two adjacent elements.&lt;br /&gt;  &lt;/p&gt;&lt;br /&gt;  &lt;p&gt;&lt;br /&gt;  The Daubechies D4 wavelet algorithm also has a wavelet&lt;br /&gt;  and a scaling function.  The coefficients for the &lt;br /&gt;  scaling function are denoted as h&lt;sub&gt;i&lt;/sub&gt; and the&lt;br /&gt;  wavelet coefficients are g&lt;sub&gt;i&lt;/sub&gt;.&lt;br /&gt;  &lt;/p&gt;&lt;br /&gt;  &lt;p&gt;&lt;br /&gt;  Mathematicians like to talk about wavelets in terms of&lt;br /&gt;  a wavelet algorithm applied to an infinite data set.&lt;br /&gt;  In this case one step of the forward transform can be expressed&lt;br /&gt;  as the infinite matrix of wavelet coefficients&lt;br /&gt;  represented below multiplied by the infinite signal&lt;br /&gt;  vector.&lt;br /&gt;  &lt;/p&gt;&lt;br /&gt;  &lt;pre&gt;&lt;br /&gt;     a&lt;sub&gt;i&lt;/sub&gt; = ...h0,h1,h2,h3, 0, 0, 0, 0, 0, 0, 0, ...   s&lt;sub&gt;i&lt;/sub&gt;&lt;br /&gt;     c&lt;sub&gt;i&lt;/sub&gt; = ...g0,g1,g2,g3, 0, 0, 0, 0, 0, 0, 0, ...   s&lt;sub&gt;i+1&lt;/sub&gt;&lt;br /&gt;   a&lt;sub&gt;i+1&lt;/sub&gt; = ...0, 0, h0,h1,h2,h3, 0, 0, 0, 0, 0, ...   s&lt;sub&gt;i+2&lt;/sub&gt;&lt;br /&gt;   c&lt;sub&gt;i+1&lt;/sub&gt; = ...0, 0, g0,g1,g2,g3, 0, 0, 0, 0, 0, ...   s&lt;sub&gt;i+3&lt;/sub&gt;&lt;br /&gt;   a&lt;sub&gt;i+2&lt;/sub&gt; = ...0, 0, 0, 0, h0,h1,h2,h3, 0, 0, 0, ...   s&lt;sub&gt;i+4&lt;/sub&gt;&lt;br /&gt;   c&lt;sub&gt;i+2&lt;/sub&gt; = ...0, 0, 0, 0, g0,g1,g2,g3, 0, 0, 0, ...   s&lt;sub&gt;i+5&lt;/sub&gt;&lt;br /&gt;   a&lt;sub&gt;i+3&lt;/sub&gt; = ...0, 0, 0, 0, 0, 0, h0,h1,h2,h3, 0, ...   s&lt;sub&gt;i+6&lt;/sub&gt;&lt;br /&gt;   c&lt;sub&gt;i+3&lt;/sub&gt; = ...0, 0, 0, 0, 0, 0, g0,g1,g2,g3, 0, ...   s&lt;sub&gt;i+7&lt;/sub&gt;&lt;br /&gt;  &lt;/pre&gt;&lt;br /&gt;  &lt;p&gt;&lt;br /&gt;  The dot product (inner product) of the infinite vector and&lt;br /&gt;  a row of the matrix produces either a smoother version of the&lt;br /&gt;  signal (a&lt;sub&gt;i&lt;/sub&gt;) or a wavelet coefficient (c&lt;sub&gt;i&lt;/sub&gt;).&lt;br /&gt;  &lt;/p&gt;&lt;br /&gt;  &lt;p&gt;&lt;br /&gt;  In an ordered wavelet transform, the smoothed (a&lt;sub&gt;i&lt;/sub&gt;) are&lt;br /&gt;  stored in the first half of an &lt;i&gt;n&lt;/i&gt; element array region.  The&lt;br /&gt;  wavelet coefficients (c&lt;sub&gt;i&lt;/sub&gt;) are stored in the second half&lt;br /&gt;  the &lt;i&gt;n&lt;/i&gt; element region.  The algorithm is recursive.  The&lt;br /&gt;  smoothed values become the input to the next step.&lt;br /&gt;  &lt;/p&gt;&lt;br /&gt;  &lt;p&gt;&lt;br /&gt;  The transpose of the forward transform matrix above is used&lt;br /&gt;  to calculate an inverse transform step.  Here the dot product is&lt;br /&gt;  formed from the result of the forward transform and an inverse&lt;br /&gt;  transform matrix row.&lt;br /&gt;  &lt;/p&gt;&lt;br /&gt;  &lt;pre&gt;&lt;br /&gt;      s&lt;sub&gt;i&lt;/sub&gt; = ...h2,g2,h0,g0, 0, 0, 0, 0, 0, 0, 0, ...  a&lt;sub&gt;i&lt;/sub&gt;&lt;br /&gt;    s&lt;sub&gt;i+1&lt;/sub&gt; = ...h3,g3,h1,g1, 0, 0, 0, 0, 0, 0, 0, ...  c&lt;sub&gt;i&lt;/sub&gt;&lt;br /&gt;    s&lt;sub&gt;i+2&lt;/sub&gt; = ...0, 0, h2,g2,h0,g0, 0, 0, 0, 0, 0, ...  a&lt;sub&gt;i+1&lt;/sub&gt;&lt;br /&gt;    s&lt;sub&gt;i+3&lt;/sub&gt; = ...0, 0, h3,g3,h1,g1, 0, 0, 0, 0, 0, ...  c&lt;sub&gt;i+1&lt;/sub&gt;&lt;br /&gt;    s&lt;sub&gt;i+4&lt;/sub&gt; = ...0, 0, 0, 0, h2,g2,h0,g0, 0, 0, 0, ...  a&lt;sub&gt;i+2&lt;/sub&gt;&lt;br /&gt;    s&lt;sub&gt;i+5&lt;/sub&gt; = ...0, 0, 0, 0, h3,g3,h1,g1, 0, 0, 0, ...  c&lt;sub&gt;i+2&lt;/sub&gt;&lt;br /&gt;    s&lt;sub&gt;i+6&lt;/sub&gt; = ...0, 0, 0, 0, 0, 0, h2,g2,h0,g0, 0, ...  a&lt;sub&gt;i+3&lt;/sub&gt;&lt;br /&gt;    s&lt;sub&gt;i+7&lt;/sub&gt; = ...0, 0, 0, 0, 0, 0, h3,g3,h1,g1, 0, ...  c&lt;sub&gt;i+3&lt;/sub&gt;&lt;br /&gt;  &lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;  &lt;p&gt;&lt;br /&gt;  Using a standard dot product is grossly inefficient since most&lt;br /&gt;  of the operands are zero.  In practice the wavelet coefficient &lt;br /&gt;  values are moved along the signal vector and a four element &lt;br /&gt;  dot product is calculated.  Expressed in terms of arrays, for&lt;br /&gt;  the forward transform this would be:&lt;br /&gt;  &lt;/p&gt;&lt;br /&gt;  &lt;pre&gt;&lt;br /&gt;  a&lt;sub&gt;i&lt;/sub&gt; = s[i]*h0 + s[i+1]*h1 + s[i+2]*h2 + s[i+3]*h3&lt;br /&gt;  c&lt;sub&gt;i&lt;/sub&gt; = s[i]*g0 + s[i+1]*g1 + s[i+2]*g2 + s[i+3]*g3&lt;br /&gt;  &lt;/pre&gt;&lt;br /&gt;  &lt;p&gt;&lt;br /&gt;  This works fine if we have an infinite data set, since we don't&lt;br /&gt;  have to worry about shifting the coefficients "off the end" of&lt;br /&gt;  the signal.&lt;br /&gt;  &lt;/p&gt;&lt;br /&gt;  &lt;p&gt;&lt;br /&gt;  I sometimes joke that I left my infinite data set in my other bear&lt;br /&gt;  suit.  The only problem with the algorithm described so far is that&lt;br /&gt;  we don't have an infinite signal.  The signal is finite.  In fact&lt;br /&gt;  not only must the signal be finite, but it must have a power of two&lt;br /&gt;  number of elements.&lt;br /&gt;  &lt;/p&gt;&lt;br /&gt;  &lt;p&gt;&lt;br /&gt;  If i=N-1, the i+2 and i+3 elements will be beyond the end of &lt;br /&gt;  the array.  There are a number of methods for handling the &lt;br /&gt;  wavelet edge problem.  This version of the algorithm acts &lt;br /&gt;  like the data is periodic, where the data at the start of &lt;br /&gt;  the signal wraps around to the end.&lt;br /&gt;  &lt;/p&gt;&lt;br /&gt;  &lt;p&gt;&lt;br /&gt;  This algorithm uses a temporary array.  A Lifting Scheme version of&lt;br /&gt;  the Daubechies D4 algorithm does not require a temporary.  The&lt;br /&gt;  matrix discussion above is based on material from &lt;i&gt;Ripples in&lt;br /&gt;  Mathematics&lt;/i&gt;, by Jensen and Cour-Harbo.  Any error are mine.&lt;br /&gt;  &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;  &lt;p&gt;&lt;br /&gt;  &lt;b&gt;Author&lt;/b&gt;: Ian Kaplan&lt;br&gt;&lt;br /&gt;  &lt;b&gt;Use&lt;/b&gt;: You may use this software for any purpose as long&lt;br /&gt;  as I cannot be held liable for the result.  Please credit me&lt;br /&gt;  with authorship if use use this source code.&lt;br /&gt;  &lt;p&gt;&lt;br /&gt;  This comment is formatted for the doxygen documentation generator&lt;br /&gt;  &lt;/p&gt;&lt;br /&gt; */&lt;br /&gt;class Daubechies {&lt;br /&gt;   private:&lt;br /&gt;   /** forward transform scaling coefficients */&lt;br /&gt;   double h0, h1, h2, h3;&lt;br /&gt;   /** forward transform wave coefficients */&lt;br /&gt;   double g0, g1, g2, g3;&lt;br /&gt;&lt;br /&gt;   double Ih0, Ih1, Ih2, Ih3;&lt;br /&gt;   double Ig0, Ig1, Ig2, Ig3;&lt;br /&gt;&lt;br /&gt;   /**&lt;br /&gt;     Forward Daubechies D4 transform&lt;br /&gt;    */&lt;br /&gt; public:&lt;br /&gt;   void transform( double* a, const int n )&lt;br /&gt;   {&lt;br /&gt;      if (n &gt;= 4) {&lt;br /&gt;         int i, j;&lt;br /&gt;         const int half = n &gt;&gt; 1;&lt;br /&gt;         &lt;br /&gt;  double* tmp = new double[n];&lt;br /&gt;&lt;br /&gt;         for (i = 0, j = 0; j &lt; n-3; j += 2, i++) {&lt;br /&gt;            tmp[i]      = a[j]*h0 + a[j+1]*h1 + a[j+2]*h2 + a[j+3]*h3;&lt;br /&gt;            tmp[i+half] = a[j]*g0 + a[j+1]*g1 + a[j+2]*g2 + a[j+3]*g3;&lt;br /&gt;         }&lt;br /&gt;&lt;br /&gt;         tmp[i]      = a[n-2]*h0 + a[n-1]*h1 + a[0]*h2 + a[1]*h3;&lt;br /&gt;         tmp[i+half] = a[n-2]*g0 + a[n-1]*g1 + a[0]*g2 + a[1]*g3;&lt;br /&gt;&lt;br /&gt;         for (i = 0; i &lt; n; i++) {&lt;br /&gt;            a[i] = tmp[i];&lt;br /&gt;         }&lt;br /&gt;  delete [] tmp;&lt;br /&gt;      }&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;   /**&lt;br /&gt;     Inverse Daubechies D4 transform&lt;br /&gt;    */&lt;br /&gt;   void invTransform( double* a, const int n )&lt;br /&gt;   {&lt;br /&gt;     if (n &gt;= 4) {&lt;br /&gt;       int i, j;&lt;br /&gt;       const int half = n &gt;&gt; 1;&lt;br /&gt;       const int halfPls1 = half + 1;&lt;br /&gt;&lt;br /&gt;       double* tmp = new double[n];&lt;br /&gt;&lt;br /&gt;       //      last smooth val  last coef.  first smooth  first coef&lt;br /&gt;       tmp[0] = a[half-1]*Ih0 + a[n-1]*Ih1 + a[0]*Ih2 + a[half]*Ih3;&lt;br /&gt;       tmp[1] = a[half-1]*Ig0 + a[n-1]*Ig1 + a[0]*Ig2 + a[half]*Ig3;&lt;br /&gt;       for (i = 0, j = 2; i &lt; half-1; i++) {&lt;br /&gt;  //     smooth val     coef. val       smooth val    coef. val&lt;br /&gt;  tmp[j++] = a[i]*Ih0 + a[i+half]*Ih1 + a[i+1]*Ih2 + a[i+halfPls1]*Ih3;&lt;br /&gt;  tmp[j++] = a[i]*Ig0 + a[i+half]*Ig1 + a[i+1]*Ig2 + a[i+halfPls1]*Ig3;&lt;br /&gt;       }&lt;br /&gt;       for (i = 0; i &lt; n; i++) {&lt;br /&gt;  a[i] = tmp[i];&lt;br /&gt;       }&lt;br /&gt;       delete [] tmp;&lt;br /&gt;     }&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;   Daubechies() &lt;br /&gt;   {&lt;br /&gt;      const double sqrt_3 = sqrt( 3 );&lt;br /&gt;      const double denom = 4 * sqrt( 2 );&lt;br /&gt;&lt;br /&gt;      //&lt;br /&gt;      // forward transform scaling (smoothing) coefficients&lt;br /&gt;      //&lt;br /&gt;      h0 = (1 + sqrt_3)/denom;&lt;br /&gt;      h1 = (3 + sqrt_3)/denom;&lt;br /&gt;      h2 = (3 - sqrt_3)/denom;&lt;br /&gt;      h3 = (1 - sqrt_3)/denom;&lt;br /&gt;      //&lt;br /&gt;      // forward transform wavelet coefficients&lt;br /&gt;      //&lt;br /&gt;      g0 =  h3;&lt;br /&gt;      g1 = -h2;&lt;br /&gt;      g2 =  h1;&lt;br /&gt;      g3 = -h0;&lt;br /&gt;&lt;br /&gt;      Ih0 = h2;&lt;br /&gt;      Ih1 = g2;  // h1&lt;br /&gt;      Ih2 = h0;&lt;br /&gt;      Ih3 = g0;  // h3&lt;br /&gt;&lt;br /&gt;      Ig0 = h3;&lt;br /&gt;      Ig1 = g3;  // -h0&lt;br /&gt;      Ig2 = h1;&lt;br /&gt;      Ig3 = g1;  // -h2&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;   void daubTrans( double* ts, int N )&lt;br /&gt;   {&lt;br /&gt;      int n;&lt;br /&gt;      for (n = N; n &gt;= 4; n &gt;&gt;= 1) {&lt;br /&gt;         transform( ts, n );&lt;br /&gt;      }&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;   void invDaubTrans( double* coef, int N )&lt;br /&gt;   {&lt;br /&gt;      int n;&lt;br /&gt;      for (n = 4; n &lt;= N; n &lt;&lt;= 1) {&lt;br /&gt;         invTransform( coef, n );&lt;br /&gt;      }&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;}; // Daubechies&lt;br /&gt;&lt;br /&gt;int main()&lt;br /&gt;{&lt;br /&gt;  double A[8] = {1, 1, 2, 5 , 6, 2, 4, 3};&lt;br /&gt;  int i;&lt;br /&gt;  for(i=0;i&lt;8;i++)&lt;br /&gt;    cerr&lt;&lt; A[i]&lt;&lt;" ";&lt;br /&gt;  cerr&lt;&lt; endl;&lt;br /&gt;  &lt;br /&gt;  Daubechies D;&lt;br /&gt;  D.daubTrans( (double*)A , 8 );&lt;br /&gt;  &lt;br /&gt;  for(i=0;i&lt;8;i++)&lt;br /&gt;    cerr&lt;&lt; A[i]&lt;&lt;" ";&lt;br /&gt;  cerr&lt;&lt; endl;&lt;br /&gt;  &lt;br /&gt;  D.invDaubTrans( (double*)A , 8 );&lt;br /&gt;  &lt;br /&gt;  for(i=0;i&lt;8;i++)&lt;br /&gt;    cerr&lt;&lt; A[i] &lt;&lt;" ";&lt;br /&gt;  cerr&lt;&lt; endl;&lt;br /&gt;  &lt;br /&gt;  return 1;&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7632507032661921953-4421335635343997363?l=thoughtsattheworld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thoughtsattheworld.blogspot.com/feeds/4421335635343997363/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thoughtsattheworld.blogspot.com/2005/11/debauchies-wavelets-good-sample-code.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7632507032661921953/posts/default/4421335635343997363'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7632507032661921953/posts/default/4421335635343997363'/><link rel='alternate' type='text/html' href='http://thoughtsattheworld.blogspot.com/2005/11/debauchies-wavelets-good-sample-code.html' title='Debauchies Wavelets Good Sample Code'/><author><name>Shyam</name><uri>http://www.blogger.com/profile/08673908243392570530</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7632507032661921953.post-7049981911768380030</id><published>2005-07-25T06:25:00.000-07:00</published><updated>2009-04-15T10:34:06.686-07:00</updated><title type='text'>C String Manipulation</title><content type='html'>Like most people I too feel that perl string manipulation is much better than C. But recently I found this function called strsep(). It is the best possible function.&lt;br /&gt;I am copying it below. Anyone and every1 who has ever parsed a file in C and found it difficult must read this.&lt;br /&gt;&lt;br /&gt;char* strsep(char **stringp ,char *delim);  &lt;br /&gt;stringp is the initial string and delim is the delimiter character. The result is given as char* initial portion before the delimiter and rest is stored in stringp.&lt;br /&gt;&lt;br /&gt;Eg. strcpy(string1,"shubham");&lt;br /&gt;    string2 = strsep(&amp;string1,"u");&lt;br /&gt;&lt;br /&gt;//Now string2 contains "sh" and string1 contains "bham"&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7632507032661921953-7049981911768380030?l=thoughtsattheworld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thoughtsattheworld.blogspot.com/feeds/7049981911768380030/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thoughtsattheworld.blogspot.com/2005/07/c-string-manipulation.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7632507032661921953/posts/default/7049981911768380030'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7632507032661921953/posts/default/7049981911768380030'/><link rel='alternate' type='text/html' href='http://thoughtsattheworld.blogspot.com/2005/07/c-string-manipulation.html' title='C String Manipulation'/><author><name>Shyam</name><uri>http://www.blogger.com/profile/08673908243392570530</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7632507032661921953.post-2829945591290194044</id><published>2005-07-21T00:11:00.000-07:00</published><updated>2009-04-15T10:34:06.686-07:00</updated><title type='text'>Wallpaper from Yahoo API Wallpaper Generator</title><content type='html'>&lt;a href="http://photos1.blogger.com/blogger/5781/541/1600/Wallpaper_angelina.jpg"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;" src="http://photos1.blogger.com/blogger/5781/541/320/Wallpaper_angelina.jpg" border="0" alt="" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7632507032661921953-2829945591290194044?l=thoughtsattheworld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thoughtsattheworld.blogspot.com/feeds/2829945591290194044/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thoughtsattheworld.blogspot.com/2005/07/wallpaper-from-yahoo-api-wallpaper.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7632507032661921953/posts/default/2829945591290194044'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7632507032661921953/posts/default/2829945591290194044'/><link rel='alternate' type='text/html' href='http://thoughtsattheworld.blogspot.com/2005/07/wallpaper-from-yahoo-api-wallpaper.html' title='Wallpaper from Yahoo API Wallpaper Generator'/><author><name>Shyam</name><uri>http://www.blogger.com/profile/08673908243392570530</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7632507032661921953.post-4004704198048724380</id><published>2005-07-21T00:09:00.000-07:00</published><updated>2009-04-15T10:34:06.686-07:00</updated><title type='text'>Yahoo API wallpaper generator</title><content type='html'>#! /usr/local/bin/perl -w&lt;br /&gt;#############################################################################&lt;br /&gt;# Yahoo Image Search Wallpaper Generator&lt;br /&gt;#&lt;br /&gt;# Written by Shubham Singal&lt;br /&gt;# shubham@gmail.com&lt;br /&gt;#&lt;br /&gt;# ############################################################################&lt;br /&gt;&lt;br /&gt;use strict;&lt;br /&gt;use warnings 'all';&lt;br /&gt;use Getopt::Long;&lt;br /&gt;use LWP::Simple;&lt;br /&gt;use constant AppUrl =&gt; "http://upster.blogspot.com/2005/03/" .&lt;br /&gt;    "yahoo-image-search-collage-generator.html";&lt;br /&gt;&lt;br /&gt;use Yahoo::Search AppId =&gt; "wallpaper_maker";&lt;br /&gt;&lt;br /&gt;my $rows    = 10;&lt;br /&gt;my $columns = 10;&lt;br /&gt;my $total = $rows * $columns;&lt;br /&gt;my $width   = 80;&lt;br /&gt;my $height  = 60;&lt;br /&gt;my $query   = "";&lt;br /&gt;my $help    = 0;&lt;br /&gt;&lt;br /&gt;GetOptions(&lt;br /&gt;    'query=s'   =&gt; \$query,&lt;br /&gt;    'rows=i'    =&gt; \$rows,&lt;br /&gt;    'columns=i' =&gt; \$columns,&lt;br /&gt;    'width=i'   =&gt; \$width,&lt;br /&gt;    'height=i'  =&gt; \$height,&lt;br /&gt;    'help'      =&gt; \$help,&lt;br /&gt;    );&lt;br /&gt;&lt;br /&gt;if ($help) {&lt;br /&gt;    print qq/$0&lt;br /&gt; --query &lt;query&gt; The text to search images for&lt;br /&gt; [--rows &lt;N&gt;]    The number of rows in the output HTML table&lt;br /&gt; [--columns &lt;N&gt;] The number of columns in the output HTML table&lt;br /&gt; [--width &lt;N&gt;]   The width of each image in the output HTML table&lt;br /&gt; [--height &lt;N&gt;]  The height of each image in the output HTML table&lt;br /&gt; [--help]        Displays this message/;&lt;br /&gt;    exit;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;die "Must specify a query!\n" unless ($query);&lt;br /&gt;&lt;br /&gt;my $folder = "folder_to_store_temp_images";&lt;br /&gt;if(-d $folder) &lt;br /&gt;{&lt;br /&gt;    system("rm -rf $folder");&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;system("mkdir $folder");&lt;br /&gt;my $i=0;&lt;br /&gt;print "Querying Yahoo...";&lt;br /&gt;&lt;br /&gt;while($total&gt;0)&lt;br /&gt;{&lt;br /&gt;    my @results = Yahoo::Search-&gt;Results(&lt;br /&gt;      Image =&gt; $query,&lt;br /&gt;      Count =&gt; 50,&lt;br /&gt;      Start =&gt; $i&lt;br /&gt;      );&lt;br /&gt;    print "\n Query DONE!\n";&lt;br /&gt;    &lt;br /&gt;    my $size = $width."x".$height;&lt;br /&gt;    foreach (@results) &lt;br /&gt;    {&lt;br /&gt; my $url = $_-&gt;ThumbUrl() ;&lt;br /&gt; if (getstore($url, "$folder/$i.jpg") eq 200)&lt;br /&gt; {&lt;br /&gt;     system("convert $folder/$i.jpg -resize $size $folder/resize_$i.jpg ");&lt;br /&gt;     print " $i";&lt;br /&gt;     $i++;&lt;br /&gt;     &lt;br /&gt; }&lt;br /&gt;    }&lt;br /&gt;    $total = $total - 50;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;$i--;&lt;br /&gt;print "\n Creating Wallpaper\n";&lt;br /&gt;my $rc = $rows."x".$columns;&lt;br /&gt;system("montage $folder/resize_*.jpg  -tile $rc -geometry +2+2 Wallpaper_$query.jpg");&lt;br /&gt;&lt;br /&gt;if(-d $folder) &lt;br /&gt;{&lt;br /&gt;    system("rm -rf $folder");&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;print "\n Wallpaper Created\n";&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7632507032661921953-4004704198048724380?l=thoughtsattheworld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thoughtsattheworld.blogspot.com/feeds/4004704198048724380/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thoughtsattheworld.blogspot.com/2005/07/yahoo-api-wallpaper-generator.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7632507032661921953/posts/default/4004704198048724380'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7632507032661921953/posts/default/4004704198048724380'/><link rel='alternate' type='text/html' href='http://thoughtsattheworld.blogspot.com/2005/07/yahoo-api-wallpaper-generator.html' title='Yahoo API wallpaper generator'/><author><name>Shyam</name><uri>http://www.blogger.com/profile/08673908243392570530</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7632507032661921953.post-8201915559052145921</id><published>2005-07-19T03:36:00.000-07:00</published><updated>2009-04-15T10:34:06.686-07:00</updated><title type='text'>ImageMagick Tutorial</title><content type='html'>http://www.cit.gu.edu.au/~anthony/graphics/imagick6/&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7632507032661921953-8201915559052145921?l=thoughtsattheworld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thoughtsattheworld.blogspot.com/feeds/8201915559052145921/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thoughtsattheworld.blogspot.com/2005/07/imagemagick-tutorial.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7632507032661921953/posts/default/8201915559052145921'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7632507032661921953/posts/default/8201915559052145921'/><link rel='alternate' type='text/html' href='http://thoughtsattheworld.blogspot.com/2005/07/imagemagick-tutorial.html' title='ImageMagick Tutorial'/><author><name>Shyam</name><uri>http://www.blogger.com/profile/08673908243392570530</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7632507032661921953.post-6488255047525785530</id><published>2005-06-30T02:17:00.000-07:00</published><updated>2009-04-15T10:34:06.687-07:00</updated><title type='text'>Good Link for Digital Image Processing</title><content type='html'>http://www.yov408.com/html/tutorials.php?s=82&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7632507032661921953-6488255047525785530?l=thoughtsattheworld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thoughtsattheworld.blogspot.com/feeds/6488255047525785530/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thoughtsattheworld.blogspot.com/2005/06/good-link-for-digital-image-processing.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7632507032661921953/posts/default/6488255047525785530'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7632507032661921953/posts/default/6488255047525785530'/><link rel='alternate' type='text/html' href='http://thoughtsattheworld.blogspot.com/2005/06/good-link-for-digital-image-processing.html' title='Good Link for Digital Image Processing'/><author><name>Shyam</name><uri>http://www.blogger.com/profile/08673908243392570530</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7632507032661921953.post-6741156133623781034</id><published>2005-06-28T22:48:00.000-07:00</published><updated>2009-04-15T10:34:06.687-07:00</updated><title type='text'>Remove Duplicate Files using Perl Script</title><content type='html'>#!/usr/local/bin/perl&lt;br /&gt;use File::stat;&lt;br /&gt;&lt;br /&gt;my @files=glob("*.jpg");&lt;br /&gt;for $fi (@files) {&lt;br /&gt;    $siz= stat($fi)-&gt;size;&lt;br /&gt;    $sizArr{$fi}=$siz;&lt;br /&gt;    # unshift(@sizArr, $siz);&lt;br /&gt;    # print "$siz\n";&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;#@sortSiz=sort(@sizArr);&lt;br /&gt;#print @sortSiz;&lt;br /&gt;&lt;br /&gt;$prevKey=0;&lt;br /&gt;foreach $key (sort by_value keys %sizArr) {&lt;br /&gt;        $xx=$sizArr{$key};&lt;br /&gt;        if ($prevKey == $xx) {&lt;br /&gt;           print $key, '*', $xx, "\n";&lt;br /&gt;           #system("mv $key dups/");&lt;br /&gt;        } else {&lt;br /&gt;           print $key, '=', $xx, "\n";&lt;br /&gt;        }&lt;br /&gt;        $prevKey=$xx;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;# sub by_value { $ary{$a} cmp $ary{$b}; }&lt;br /&gt;&lt;br /&gt;sub by_value { $sizArr{$b} &lt;=&gt; $sizArr{$a}; }&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7632507032661921953-6741156133623781034?l=thoughtsattheworld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thoughtsattheworld.blogspot.com/feeds/6741156133623781034/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thoughtsattheworld.blogspot.com/2005/06/remove-duplicate-files-using-perl.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7632507032661921953/posts/default/6741156133623781034'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7632507032661921953/posts/default/6741156133623781034'/><link rel='alternate' type='text/html' href='http://thoughtsattheworld.blogspot.com/2005/06/remove-duplicate-files-using-perl.html' title='Remove Duplicate Files using Perl Script'/><author><name>Shyam</name><uri>http://www.blogger.com/profile/08673908243392570530</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7632507032661921953.post-4555013094792950491</id><published>2005-06-27T22:13:00.000-07:00</published><updated>2009-04-15T10:34:06.687-07:00</updated><title type='text'>One More Perl Script</title><content type='html'>#!/usr/local/bin/perl&lt;br /&gt;my @dlist=glob("Im*");&lt;br /&gt;$kk=1;&lt;br /&gt;&lt;br /&gt;for $dd (@dlist) {&lt;br /&gt;   print "$dd\n";&lt;br /&gt;   chdir $dd or die "Cannot change dir to $dd: $!\n";;&lt;br /&gt;   my @files=glob("*.jpg");&lt;br /&gt;   print "@files\n";&lt;br /&gt;   for $fi (@files) {&lt;br /&gt;       print "$fi\n";&lt;br /&gt;       system("mv $fi ../testImg/$kk-$fi");&lt;br /&gt;   }&lt;br /&gt;   chdir ".." or die "Cannot change dir to ..: $!\n";&lt;br /&gt;   $kk++;&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7632507032661921953-4555013094792950491?l=thoughtsattheworld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thoughtsattheworld.blogspot.com/feeds/4555013094792950491/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thoughtsattheworld.blogspot.com/2005/06/one-more-perl-script.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7632507032661921953/posts/default/4555013094792950491'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7632507032661921953/posts/default/4555013094792950491'/><link rel='alternate' type='text/html' href='http://thoughtsattheworld.blogspot.com/2005/06/one-more-perl-script.html' title='One More Perl Script'/><author><name>Shyam</name><uri>http://www.blogger.com/profile/08673908243392570530</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7632507032661921953.post-1161055392490995087</id><published>2005-06-23T00:02:00.000-07:00</published><updated>2009-04-15T10:34:06.687-07:00</updated><title type='text'>Creating Stereo Images Easily</title><content type='html'>http://www.photostuff.co.uk/stereo.htm&lt;br /&gt;A cool link about creating Stereo Images&lt;br /&gt;&lt;br /&gt;int red, green, blue;&lt;br /&gt;int[] StereoPixels = (int[])anaglyphIP.getPixels();&lt;br /&gt;int[] LeftPixels = (int[])LeftIP.getPixels(); // left eye image&lt;br /&gt;int[] RightPixels = (int[])RightIP.getPixels(); // right eye image&lt;br /&gt;        &lt;br /&gt;for(int i=0;i&lt; LWidth*LHeight;i++){&lt;br /&gt;red = (LeftPixels[i] &amp; 0xff0000)&gt;&gt; 16;       //Left eye consists of red channel&lt;br /&gt;green = (RightPixels[i] &amp; 0xff00ff00)&gt;&gt;8;   // Right eye image consists of green and blue channel&lt;br /&gt;blue = (RightPixels[i] &amp; 0x0000ff);&lt;br /&gt;            &lt;br /&gt;StereoPixels[i] = ((red &amp; 0xff)&lt;&lt;16)+((green &amp; 0xff)&lt;&lt;8) + (blue &amp; 0xff);&lt;br /&gt;}&lt;br /&gt;anaglyphIP.setPixels(StereoPixels);&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7632507032661921953-1161055392490995087?l=thoughtsattheworld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thoughtsattheworld.blogspot.com/feeds/1161055392490995087/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thoughtsattheworld.blogspot.com/2005/06/creating-stereo-images-easily.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7632507032661921953/posts/default/1161055392490995087'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7632507032661921953/posts/default/1161055392490995087'/><link rel='alternate' type='text/html' href='http://thoughtsattheworld.blogspot.com/2005/06/creating-stereo-images-easily.html' title='Creating Stereo Images Easily'/><author><name>Shyam</name><uri>http://www.blogger.com/profile/08673908243392570530</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7632507032661921953.post-4356024400563340424</id><published>2005-06-17T03:54:00.000-07:00</published><updated>2009-04-15T10:34:06.687-07:00</updated><title type='text'>Another Bit Manipulation Function</title><content type='html'>count=0;//count number of bits&lt;br /&gt;k=2;//number of bits to be removed from R&lt;br /&gt;unsigned char a1;&lt;br /&gt;num=8;//bits empty in a1&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;int given(unsigned char R)&lt;br /&gt;{&lt;br /&gt;  //right now a1 has num bits empty&lt;br /&gt;  //hence copy min(num,8-k) bits from R to a1&lt;br /&gt;  b_count=min(num,8-k);&lt;br /&gt;  if(num&lt;8-k)&lt;br /&gt;    {&lt;br /&gt;      a=R&gt;&gt;(8-num);//num bits of R left in a&lt;br /&gt;      a1 = a1 | a;//fill a1 and write to disk&lt;br /&gt;      ////write a1 to disk&lt;br /&gt;      if(num== (8-k))&lt;br /&gt; {&lt;br /&gt;   //we have copied entire R after removing k bits hence no fight&lt;br /&gt;   num=8;//since written to disk consider a1 empty&lt;br /&gt; }&lt;br /&gt;      else //some portion of R is left and hence we must copy that into a1&lt;br /&gt; {&lt;br /&gt;   a=R&gt;&gt;k;// remove ending k bits of R&lt;br /&gt;   a=R&lt;&lt;(num+k);//remove starting num bits of R&lt;br /&gt;   &lt;br /&gt;   a1=a;//copy all the bits to a1&lt;br /&gt;   num=k+num; // k + num bits of a1 are empty as of now&lt;br /&gt; }&lt;br /&gt;    }&lt;br /&gt;  else&lt;br /&gt;    {&lt;br /&gt;      a=R&gt;&gt;k;//remove last k bits of R&lt;br /&gt;      a=a&lt;&lt;k;&lt;br /&gt;      a=a&gt;&gt;(8-num);//align with a1&lt;br /&gt;      a1=a1|a;//take or of a1 and a&lt;br /&gt;      num=num+8-k;&lt;br /&gt;    }&lt;br /&gt;      &lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7632507032661921953-4356024400563340424?l=thoughtsattheworld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thoughtsattheworld.blogspot.com/feeds/4356024400563340424/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thoughtsattheworld.blogspot.com/2005/06/another-bit-manipulation-function.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7632507032661921953/posts/default/4356024400563340424'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7632507032661921953/posts/default/4356024400563340424'/><link rel='alternate' type='text/html' href='http://thoughtsattheworld.blogspot.com/2005/06/another-bit-manipulation-function.html' title='Another Bit Manipulation Function'/><author><name>Shyam</name><uri>http://www.blogger.com/profile/08673908243392570530</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7632507032661921953.post-958001435390234545</id><published>2005-06-17T00:11:00.000-07:00</published><updated>2009-04-15T10:34:06.687-07:00</updated><title type='text'>Get Unique Elements</title><content type='html'>#! /usr/local/bin/perl -w&lt;br /&gt;open(FILEREAD, "finale");&lt;br /&gt;open(FILEWR, "&gt;fin");&lt;br /&gt;@in=&lt;FILEREAD&gt;;&lt;br /&gt;&lt;br /&gt;undef %saw;&lt;br /&gt;@out = grep(!$saw{$_}++, @in);&lt;br /&gt;print @out;&lt;br /&gt;print FILEWR @out;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7632507032661921953-958001435390234545?l=thoughtsattheworld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thoughtsattheworld.blogspot.com/feeds/958001435390234545/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thoughtsattheworld.blogspot.com/2005/06/get-unique-elements.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7632507032661921953/posts/default/958001435390234545'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7632507032661921953/posts/default/958001435390234545'/><link rel='alternate' type='text/html' href='http://thoughtsattheworld.blogspot.com/2005/06/get-unique-elements.html' title='Get Unique Elements'/><author><name>Shyam</name><uri>http://www.blogger.com/profile/08673908243392570530</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7632507032661921953.post-7673578697112625373</id><published>2005-06-15T23:38:00.000-07:00</published><updated>2009-04-15T10:34:06.687-07:00</updated><title type='text'>Wavelets Haar Daubechies</title><content type='html'>Wavelets here ... wavelets there ... but for computer vision and graphics I recommend these tutorials&lt;br /&gt;&lt;br /&gt;http://www.bearcave.com/misl/misl_tech/wavelets/haar.html&lt;br /&gt;&lt;br /&gt;AND&lt;br /&gt;&lt;br /&gt;Wavelets for Computer Graphics: A Primer Part 1 and Part 2&lt;br /&gt;in computer graphics with some intuition for what wavelets are, as ... Wavelets for Computer Graphics: Theory and Applications. ...&lt;br /&gt;http://grail.cs.washington.edu/pub/stoll/wavelet1.pdf&lt;br /&gt;http://grail.cs.washington.edu/pub/stoll/wavelet2.pdf&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7632507032661921953-7673578697112625373?l=thoughtsattheworld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thoughtsattheworld.blogspot.com/feeds/7673578697112625373/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thoughtsattheworld.blogspot.com/2005/06/wavelets-haar-daubechies.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7632507032661921953/posts/default/7673578697112625373'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7632507032661921953/posts/default/7673578697112625373'/><link rel='alternate' type='text/html' href='http://thoughtsattheworld.blogspot.com/2005/06/wavelets-haar-daubechies.html' title='Wavelets Haar Daubechies'/><author><name>Shyam</name><uri>http://www.blogger.com/profile/08673908243392570530</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7632507032661921953.post-5216092598183759026</id><published>2005-06-15T02:12:00.000-07:00</published><updated>2009-04-15T10:34:06.688-07:00</updated><title type='text'>Html Text over an Image</title><content type='html'>&lt;h4&gt;The Code That Does It&lt;/h4&gt;&lt;br /&gt;&lt;center&gt;&lt;br /&gt;&lt;table border="0"&gt;&lt;TD&gt;&lt;br /&gt;&lt;font color="#800000" size="-1"&gt;&amp;lt;TABLE BORDER="0" cellpadding="0" CELLSPACING="0"&amp;gt;&lt;BR&gt;&lt;br /&gt;&amp;lt;TR&amp;gt;&lt;BR&gt;&lt;BR&gt;&lt;br /&gt;&amp;lt;TD WIDTH="221" HEIGHT="300" BACKGROUND="newjoe01.jpg" VALIGN="bottom"&amp;gt;&lt;BR&gt;&lt;br&gt;&amp;lt;FONT SIZE="+1" COLOR="yellow"&amp;gt;Joe Burns at Work&amp;lt;/FONT&amp;gt;&amp;lt;/TD&amp;gt;&lt;BR&gt;&lt;BR&gt;&lt;br /&gt;&amp;lt;/TR&amp;gt;&lt;BR&gt;&lt;br /&gt;&amp;lt;/TABLE&amp;gt;&lt;/font&gt;&lt;BR&gt;&lt;BR&gt;&lt;br /&gt;&lt;/TD&gt;&lt;br /&gt;&lt;/table&gt;&lt;br /&gt;&lt;/center&gt;&lt;br /&gt;&lt;P&gt;&lt;br /&gt;OR&lt;br /&gt;USE DIV AND PLACEMENT&lt;br /&gt;OR&lt;br /&gt;go to http://www.htmlgoodies.com/tutorials/web_graphics/article.php/3480021&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7632507032661921953-5216092598183759026?l=thoughtsattheworld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thoughtsattheworld.blogspot.com/feeds/5216092598183759026/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thoughtsattheworld.blogspot.com/2005/06/html-text-over-image.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7632507032661921953/posts/default/5216092598183759026'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7632507032661921953/posts/default/5216092598183759026'/><link rel='alternate' type='text/html' href='http://thoughtsattheworld.blogspot.com/2005/06/html-text-over-image.html' title='Html Text over an Image'/><author><name>Shyam</name><uri>http://www.blogger.com/profile/08673908243392570530</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7632507032661921953.post-1046752706216132942</id><published>2005-06-15T02:08:00.000-07:00</published><updated>2009-04-15T10:34:06.688-07:00</updated><title type='text'>Perl Script: directory file manip</title><content type='html'>To perform some actions on all files in a directory&lt;br /&gt; #!/usr/bin/perl&lt;br /&gt;&lt;br /&gt;$input_directory = ".";&lt;br /&gt;chomp $input_directory;&lt;br /&gt;&lt;br /&gt;until (-d $input_directory)  { # the -d bit means check if there is a directory called ...&lt;br /&gt;        print "Sorry, that path / directory does not appear to exist, please try again.\n";&lt;br /&gt;        $input_directory = &lt;STDIN&gt;;&lt;br /&gt;        chomp $input_directory;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;opendir (INPUTDIR, $input_directory) || die "sorry, system cannot open $input_directory $input_directory";&lt;br /&gt;&lt;br /&gt;while ($infile = readdir(INPUTDIR)) {&lt;br /&gt;    chomp $infile;&lt;br /&gt;    if ($infile !~ /^\./) {&lt;br /&gt; if ($infile =~ /.*pgm/) {&lt;br /&gt;     $outfile = substr($infile,0,length($infile)-4);&lt;br /&gt;     print "\n convert $infile $outfile.jpg";&lt;br /&gt;     system("\n convert $infile $outfile.jpg");&lt;br /&gt; }&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;closedir (INPUTDIR);&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7632507032661921953-1046752706216132942?l=thoughtsattheworld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thoughtsattheworld.blogspot.com/feeds/1046752706216132942/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thoughtsattheworld.blogspot.com/2005/06/perl-script-directory-file-manip.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7632507032661921953/posts/default/1046752706216132942'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7632507032661921953/posts/default/1046752706216132942'/><link rel='alternate' type='text/html' href='http://thoughtsattheworld.blogspot.com/2005/06/perl-script-directory-file-manip.html' title='Perl Script: directory file manip'/><author><name>Shyam</name><uri>http://www.blogger.com/profile/08673908243392570530</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7632507032661921953.post-4962465683431769402</id><published>2005-06-14T02:08:00.000-07:00</published><updated>2009-04-15T10:34:06.688-07:00</updated><title type='text'>Store Images using Yahoo! API</title><content type='html'>&lt;p&gt;&lt;br /&gt;#! /usr/local/bin/perl -w&lt;br /&gt;&lt;br /&gt;######program takes in keywords file and puts images in dir images/ and creates file Im&lt;br /&gt;ageData with all the data for the images.&lt;br /&gt;use strict;&lt;br /&gt;use warnings 'all';&lt;br /&gt;use Getopt::Long;&lt;br /&gt;use LWP::Simple;&lt;br /&gt;use Yahoo::Search AppId =&gt; "shubh_iitd";&lt;br /&gt;&lt;br /&gt;my $i=0;&lt;br /&gt;open(FILEREAD, "keywords");&lt;br /&gt;&lt;br /&gt;open(FILEWRITE, "&gt;ImageData");&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;while (&lt;FILEREAD&gt;){&lt;br /&gt;        print " word is: $_";&lt;br /&gt;        my $query=$_;&lt;br /&gt;        my @results = Yahoo::Search-&gt;Results(&lt;br /&gt;                                             Image =&gt; $query,&lt;br /&gt;                                             Count =&gt; 10&lt;br /&gt;                                             );&lt;br /&gt;&lt;br /&gt;        foreach (@results) {&lt;br /&gt;            my $url = $_-&gt;Url();&lt;br /&gt;            print "\n $i - $url";&lt;br /&gt;            if (getstore($url, "images/$i.jpg") eq 200){&lt;br /&gt;                my $im = 0;&lt;br /&gt;                open(IN, "images/$i.jpg");&lt;br /&gt;                binmode(IN);&lt;br /&gt;                read(IN,$b,4);&lt;br /&gt;                my $s = 2*length($b);&lt;br /&gt;                my $ch = unpack("H$s", $b);&lt;br /&gt;                print "\n |$ch| ";&lt;br /&gt;                if($ch eq "ffd8ffe0") {print " JPEG ";$im=1;}&lt;br /&gt;                if($ch eq "47494638") {print " GIF ";$im=1;}&lt;br /&gt;                if($ch eq "89504e47") {print " PNG ";$im=1;}&lt;br /&gt;                if($ch eq "4d4d002a") {print " TIFF Big Endian ";$im=1;}&lt;br /&gt;                if($ch eq "49492a00") {print " TIFF Little Endian ";$im=1;}&lt;br /&gt;                if($ch =~ /^424d/) {print " BMP ";$im=1;}&lt;br /&gt;                close(IN);&lt;br /&gt;                if($im eq 1){&lt;br /&gt;                    $i++;&lt;br /&gt;                    print FILEWRITE "$i.jpg - $url - $query\n";&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;    }&lt;br /&gt;close FILEREAD;&lt;br /&gt;close FILEWRITE;&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7632507032661921953-4962465683431769402?l=thoughtsattheworld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thoughtsattheworld.blogspot.com/feeds/4962465683431769402/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thoughtsattheworld.blogspot.com/2005/06/store-images-using-yahoo-api.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7632507032661921953/posts/default/4962465683431769402'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7632507032661921953/posts/default/4962465683431769402'/><link rel='alternate' type='text/html' href='http://thoughtsattheworld.blogspot.com/2005/06/store-images-using-yahoo-api.html' title='Store Images using Yahoo! API'/><author><name>Shyam</name><uri>http://www.blogger.com/profile/08673908243392570530</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7632507032661921953.post-9057773824521089344</id><published>2005-06-07T01:17:00.000-07:00</published><updated>2009-04-15T10:34:06.688-07:00</updated><title type='text'>Read till EOF using FILE*</title><content type='html'>To Read upto end of file using FILE* in c&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  while (fgets(fname,100,f))&lt;br /&gt;        {&lt;br /&gt;               //do anything&lt;br /&gt;        }&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7632507032661921953-9057773824521089344?l=thoughtsattheworld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thoughtsattheworld.blogspot.com/feeds/9057773824521089344/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thoughtsattheworld.blogspot.com/2005/06/read-till-eof-using-file.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7632507032661921953/posts/default/9057773824521089344'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7632507032661921953/posts/default/9057773824521089344'/><link rel='alternate' type='text/html' href='http://thoughtsattheworld.blogspot.com/2005/06/read-till-eof-using-file.html' title='Read till EOF using FILE*'/><author><name>Shyam</name><uri>http://www.blogger.com/profile/08673908243392570530</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7632507032661921953.post-6418640929631605708</id><published>2005-06-06T05:59:00.000-07:00</published><updated>2009-04-15T10:34:06.688-07:00</updated><title type='text'>Bit Holder</title><content type='html'>Class for storing bits as unsigned char for compression,&lt;br /&gt;public:&lt;br /&gt;  IntC index;&lt;br /&gt;  IntC nbits;&lt;br /&gt;  IntC size;&lt;br /&gt;  IntC csize;&lt;br /&gt;  vector&lt;unsigned char&gt; bits;//storing the bits, 8 bits in each unsigned char&lt;br /&gt;  unsigned char temp[8];//temprory for storing data&lt;br /&gt;  IntC tempsize;&lt;br /&gt;&lt;br /&gt;  void BitHolderInit(IntC dimension, IntC ind)&lt;br /&gt;  {&lt;br /&gt;    index=ind;&lt;br /&gt;    nbits=dimension;&lt;br /&gt;    IntC i; if(dimension%8) i=dimension/8; else i=dimension/8 + 1;&lt;br /&gt;    size = i; tempsize = 0; csize = 0;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  int BitHolderWrite()&lt;br /&gt;  {&lt;br /&gt;    if (tempsize != 8) return -1;&lt;br /&gt;    //cerr&lt;&lt;"\n Csize : "&lt;&lt; csize &lt;&lt;" "&lt;&lt; size&lt;&lt;" "&lt;&lt; nbits&lt;&lt;" "&lt;&lt; tempsize;&lt;br /&gt;&lt;br /&gt;    bits.push_back( ((temp[0] &amp; 0x1)&lt;&lt;7) | ((temp[1] &amp; 0x1)&lt;&lt;6) | ((temp[2] &amp; 0x1)&lt;br /&gt;&lt;&lt; 5) | ((temp[3] &amp; 0x1)&lt;&lt; 4) | ((temp[4] &amp; 0x1)&lt;&lt; 3) | ((temp[5] &amp; 0x1)&lt;&lt; 2) | ((temp[6] &amp; 0x1)&lt;&lt; 1) | (temp[7] &amp; 0x1) );&lt;br /&gt;    //   bits.push_back(((temp[0] &amp; 0x1)&lt;&lt;7) | ((temp[1] &amp; 0x1)&lt;&lt;6 &amp; 0x) | ((temp[&lt;br /&gt;2] &amp; 0x1)&lt;&lt;5) | ((temp[3] &amp; 0x1)&lt;&lt;4) | ((temp[4] &amp; 0x1)&lt;&lt;3) | ((temp[5] &amp; 0x1)&lt;&lt;2)&lt;br /&gt; | ((temp[6] &amp; 0x1)&lt;&lt;1) | ((temp[7] &amp; 0x1)));&lt;br /&gt;&lt;br /&gt;    tempsize=0; csize++;&lt;br /&gt;    temp[0]=temp[1]=temp[2]=temp[3]=temp[4]=temp[5]=temp[6]=temp[7]='0';&lt;br /&gt;    return 1;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  int AddBit(IntC b)&lt;br /&gt;  {&lt;br /&gt;    //cerr&lt;&lt;" ADDING "&lt;&lt; b&lt;&lt;" "&lt;&lt; tempsize;&lt;br /&gt;    if(b==0) temp[tempsize]='0'; else temp[tempsize]='1';&lt;br /&gt;    tempsize++;&lt;br /&gt;    if(tempsize==8) BitHolderWrite();&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt; int GetBit(IntC pos)&lt;br /&gt;  {&lt;br /&gt;    //cerr&lt;&lt;" Position : "&lt;&lt; pos&lt;&lt;" "&lt;&lt; pos/8&lt;&lt;" "&lt;&lt; pos%8&lt;&lt;" "&lt;&lt; bits.size();;&lt;br /&gt;&lt;br /&gt;    if(pos&gt;nbits) {cerr&lt;&lt;" ERROR ";return -1;}&lt;br /&gt;&lt;br /&gt;    if(((pos-1)/8)&lt; bits.size())&lt;br /&gt;      {&lt;br /&gt;        if (((bits[(pos-1)/8] &gt;&gt; (7-(pos-1)%8)) &amp; 0x1) == 0x1)&lt;br /&gt;          return 1;&lt;br /&gt;        else&lt;br /&gt;          return 0;&lt;br /&gt;      }&lt;br /&gt;&lt;br /&gt;    pos=(pos)%8;&lt;br /&gt;    pos--;&lt;br /&gt;    //cerr&lt;&lt;" "&lt;&lt; pos&lt;&lt;" "&lt;&lt; tempsize&lt;&lt;" "&lt;&lt; temp[pos];&lt;br /&gt;    if(temp[pos]=='1') return 1; else return 0;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  int PrintBits()&lt;br /&gt;  {&lt;br /&gt;    cerr&lt;&lt;" Printing Bits Index:"&lt;&lt; index&lt;&lt;" nBits:"&lt;&lt; nbits&lt;&lt;"  ";&lt;br /&gt;    for (IntC i = 0; i &lt; bits.size(); i++)&lt;br /&gt;      {&lt;br /&gt;        cerr&lt;&lt;(bits[i]&gt;&gt;7 &amp; 0x1)&lt;&lt;(bits[i]&gt;&gt;6 &amp; 0x1)&lt;&lt;(bits[i]&gt;&gt;5 &amp; 0x1)&lt;&lt;(bits[i]&lt;br /&gt;&gt;&gt;4 &amp; 0x1)&lt;&lt;(bits[i]&gt;&gt;3 &amp; 0x1)&lt;&lt;(bits[i]&gt;&gt;2 &amp; 0x1)&lt;&lt;(bits[i]&gt;&gt;1 &amp; 0x1)&lt;&lt;(bits[i] &amp;&lt;br /&gt; 0x1);&lt;br /&gt;      }&lt;br /&gt;&lt;br /&gt;    for (IntC i = 0; i &lt; tempsize; i++)&lt;br /&gt;      cerr&lt;&lt; temp[i];&lt;br /&gt;    return 1;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;} BitHolder,*PBitHolder;&lt;br /&gt;&lt;br /&gt;bool operator&lt;(const  BitHolder &amp;a, const  BitHolder &amp;b)&lt;br /&gt;{&lt;br /&gt;  //cerr&lt;&lt;"\n SORTING "&lt;&lt; a.index&lt;&lt;" "&lt;&lt; b.index;&lt;br /&gt;  IntC i,j;&lt;br /&gt;  for(i=0;i&lt; a.bits.size();i++)&lt;br /&gt;    {&lt;br /&gt;      for(j=7;j&gt;=0;j--)&lt;br /&gt;        {&lt;br /&gt;          //cerr&lt;&lt;"| i:"&lt;&lt; i&lt;&lt;" j:"&lt;&lt; j&lt;&lt;" "&lt;&lt;(a.bits[i] &gt;&gt; j &amp; 0x1)&lt;&lt;" "&lt;&lt; (b.bits[&lt;br /&gt;i] &gt;&gt; j &amp; 0x1);&lt;br /&gt;          if(((a.bits[i] &gt;&gt; j &amp; 0x1)==0x1)&amp;&amp;((b.bits[i] &gt;&gt; j &amp; 0x1)==0x0))&lt;br /&gt;            return false;&lt;br /&gt;          if(((a.bits[i] &gt;&gt; j &amp; 0x1)==0x0)&amp;&amp;((b.bits[i] &gt;&gt; j &amp; 0x1)==0x1))&lt;br /&gt;            return true;&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;  //cerr&lt;&lt;" Tempsize : "&lt;&lt; a.tempsize;&lt;br /&gt;  for(i=0;i&lt; a.tempsize;i++)&lt;br /&gt;    {&lt;br /&gt;      if((a.temp[i]=='1')&amp;&amp;(b.temp[i]=='0'))&lt;br /&gt;        return false;&lt;br /&gt;      if((a.temp[i]=='0')&amp;&amp;(b.temp[i]=='1'))&lt;br /&gt;        return true;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;  return false;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;bool operator==(const  BitHolder &amp;a, const  BitHolder &amp;b)&lt;br /&gt;{if(((a&lt; b)==false)&amp;&amp;((b&lt; a)==false)) return true; else false;}&lt;br /&gt;&lt;br /&gt;bool operator&gt;(const  BitHolder &amp;a, const  BitHolder &amp;b)&lt;br /&gt;{if (b &lt; a) return true; else false;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7632507032661921953-6418640929631605708?l=thoughtsattheworld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thoughtsattheworld.blogspot.com/feeds/6418640929631605708/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thoughtsattheworld.blogspot.com/2005/06/bit-holder.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7632507032661921953/posts/default/6418640929631605708'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7632507032661921953/posts/default/6418640929631605708'/><link rel='alternate' type='text/html' href='http://thoughtsattheworld.blogspot.com/2005/06/bit-holder.html' title='Bit Holder'/><author><name>Shyam</name><uri>http://www.blogger.com/profile/08673908243392570530</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7632507032661921953.post-9017973960701995067</id><published>2005-06-06T05:58:00.000-07:00</published><updated>2009-04-15T10:34:06.688-07:00</updated><title type='text'>Random Distribution: Gaussian</title><content type='html'>Some random number genertion codes for some distributions&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;// The state vector for generation of random numbers.&lt;br /&gt;char rngState[256];&lt;br /&gt;&lt;br /&gt;// Initialize the random number generator.&lt;br /&gt;void initRandom(){&lt;br /&gt;  initstate(2, rngState, 256);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// Generate a random integer in the range [rangeStart,&lt;br /&gt;// rangeEnd]. Inputs must satisfy: rangeStart &lt;= rangeEnd.&lt;br /&gt;IntC genRandomInt(IntC rangeStart, IntC rangeEnd){&lt;br /&gt;  if(!(rangeStart &lt;= rangeEnd)) return -1;&lt;br /&gt;  IntC r;&lt;br /&gt;  r = rangeStart + (IntC)((rangeEnd - rangeStart + 1.0) * random() / (RAND_MAX + 1&lt;br /&gt;.0));&lt;br /&gt;  return r;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// Generate a random 32-bits unsigned (Uns32C) in the range&lt;br /&gt;// [rangeStart, rangeEnd]. Inputs must satisfy: rangeStart &lt;=&lt;br /&gt;// rangeEnd.&lt;br /&gt;Uns32C genRandomUns32(Uns32C rangeStart, Uns32C rangeEnd){&lt;br /&gt;  Uns32C r;&lt;br /&gt;  if (RAND_MAX &gt;= rangeEnd - rangeStart) {&lt;br /&gt;    r = rangeStart + (Uns32C)((rangeEnd - rangeStart + 1.0) * random() / (RAND_MAX&lt;br /&gt; + 1.0));&lt;br /&gt;  } else {&lt;br /&gt;    r = rangeStart + (Uns32C)((rangeEnd - rangeStart + 1.0) * ((LongUns64C)random(&lt;br /&gt;) * ((LongUns64C)RAND_MAX + 1) + (LongUns64C)random()) / ((LongUns64C)RAND_MAX * (&lt;br /&gt;(LongUns64C)RAND_MAX + 1) + (LongUns64C)RAND_MAX + 1.0));&lt;br /&gt;  }&lt;br /&gt;  return r;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// Generate a random real distributed uniformly in [rangeStart,&lt;br /&gt;// rangeEnd]. Input must satisfy: rangeStart &lt;= rangeEnd. The&lt;br /&gt;// granularity of generated random reals is given by RAND_MAX.&lt;br /&gt;RealC genUniformRandom(RealC rangeStart, RealC rangeEnd){&lt;br /&gt;  RealC r;&lt;br /&gt;  r = rangeStart + ((rangeEnd - rangeStart) * (RealC)random() / (RealC)RAND_MAX);&lt;br /&gt;  return r;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// Generate a random real from normal distribution N(0,1).&lt;br /&gt;RealC genGaussianRandom(){&lt;br /&gt;  // Use Box-Muller transform to generate a point from normal&lt;br /&gt;  // distribution.&lt;br /&gt;  RealC x1, x2;&lt;br /&gt;  do{    x1 = genUniformRandom(0.0, 1.0);  } while (x1 == 0); // cannot take log o&lt;br /&gt;f 0.&lt;br /&gt;  x2 = genUniformRandom(0.0, 1.0);&lt;br /&gt;  RealC z;&lt;br /&gt;  z = SQRT(-2.0 * log(x1)) * COS(2.0 * M_PI * x2);&lt;br /&gt;  return z;&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7632507032661921953-9017973960701995067?l=thoughtsattheworld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thoughtsattheworld.blogspot.com/feeds/9017973960701995067/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thoughtsattheworld.blogspot.com/2005/06/random-distribution-gaussian.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7632507032661921953/posts/default/9017973960701995067'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7632507032661921953/posts/default/9017973960701995067'/><link rel='alternate' type='text/html' href='http://thoughtsattheworld.blogspot.com/2005/06/random-distribution-gaussian.html' title='Random Distribution: Gaussian'/><author><name>Shyam</name><uri>http://www.blogger.com/profile/08673908243392570530</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7632507032661921953.post-2629316930795709278</id><published>2005-06-06T05:57:00.000-07:00</published><updated>2009-04-15T10:34:06.689-07:00</updated><title type='text'>GetStore and Url Extraction</title><content type='html'>Things to Note:&lt;br /&gt;perl program can take out URL out of xml files,&lt;br /&gt;getstore() can store the file at the given url &lt;br /&gt;&lt;br /&gt;&lt;br /&gt; @lines= split(/ /,$line);&lt;br /&gt;&lt;br /&gt;    @url="";&lt;br /&gt;    @filenames="";&lt;br /&gt;&lt;br /&gt;    foreach $item (@lines)&lt;br /&gt;    {&lt;br /&gt;        if($item =~ /^URL*/)&lt;br /&gt;        {&lt;br /&gt;            $i=index($item,"\"");&lt;br /&gt;            $j=rindex($item,"\"");&lt;br /&gt;            push(@url,substr($item,$i+1,$j-$i-1));&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    foreach $item (@url)&lt;br /&gt;    {&lt;br /&gt;        print "\n ";&lt;br /&gt;        $i=rindex($item,"/");&lt;br /&gt;        $filename= substr($item,$i+1,length($item)-2-$i);&lt;br /&gt;        push(@filenames, $filename);&lt;br /&gt;        if( getstore($item,"$dir/$numg-$filename") &lt; 400)&lt;br /&gt;        {$numg++;}&lt;br /&gt;    }&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7632507032661921953-2629316930795709278?l=thoughtsattheworld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thoughtsattheworld.blogspot.com/feeds/2629316930795709278/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thoughtsattheworld.blogspot.com/2005/06/getstore-and-url-extraction.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7632507032661921953/posts/default/2629316930795709278'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7632507032661921953/posts/default/2629316930795709278'/><link rel='alternate' type='text/html' href='http://thoughtsattheworld.blogspot.com/2005/06/getstore-and-url-extraction.html' title='GetStore and Url Extraction'/><author><name>Shyam</name><uri>http://www.blogger.com/profile/08673908243392570530</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7632507032661921953.post-7864223706418011455</id><published>2005-06-06T05:54:00.000-07:00</published><updated>2009-04-15T10:34:06.689-07:00</updated><title type='text'>Magic Number in Perl</title><content type='html'>A way to check for various image formats, the code is in perl. It checks the magic number for the image format&lt;br /&gt;&lt;br /&gt;($in) = @ARGV;&lt;br /&gt;die "Missing input file name.\n" unless $in;&lt;br /&gt;&lt;br /&gt;$im = 0;&lt;br /&gt;open(IN, "&lt; $in");&lt;br /&gt;binmode(IN);&lt;br /&gt;read(IN,$b,4);&lt;br /&gt;$s = 2*length($b);&lt;br /&gt;$ch = unpack("H$s", $b);&lt;br /&gt;print "\n |$ch| ";&lt;br /&gt;if($ch eq "ffd8ffe0") {print " JPEG ";$im=1;}&lt;br /&gt;if($ch eq "47494638") {print " GIF ";$im=1;}&lt;br /&gt;if($ch eq "89504e47") {print " PNG ";$im=1;}&lt;br /&gt;if($ch eq "4d4d002a") {print " TIFF Big Endian ";$im=1;}&lt;br /&gt;if($ch eq "49492a00") {print " TIFF Little Endian ";$im=1;}&lt;br /&gt;if($ch =~ /^424d/) {print " BMP ";$im=1;}&lt;br /&gt;close(IN);&lt;br /&gt;&lt;br /&gt;exit;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7632507032661921953-7864223706418011455?l=thoughtsattheworld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thoughtsattheworld.blogspot.com/feeds/7864223706418011455/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thoughtsattheworld.blogspot.com/2005/06/magic-number-in-perl.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7632507032661921953/posts/default/7864223706418011455'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7632507032661921953/posts/default/7864223706418011455'/><link rel='alternate' type='text/html' href='http://thoughtsattheworld.blogspot.com/2005/06/magic-number-in-perl.html' title='Magic Number in Perl'/><author><name>Shyam</name><uri>http://www.blogger.com/profile/08673908243392570530</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7632507032661921953.post-2504513275061181978</id><published>2005-03-31T06:19:00.000-08:00</published><updated>2009-04-15T10:34:06.689-07:00</updated><title type='text'>Windowmaker Themes</title><content type='html'>To set themes in windowmaker type the command&lt;br /&gt;&lt;br /&gt;setstyle aay.themed&lt;br /&gt;&lt;br /&gt;but the particular folder should contain the style file for the theme. I found some cool themes at http://themes.freshmeat.net/browse/918/?topic_id=918 with style files in them. I don't know how to change the style with lsm file. Maybe if I find it soon enough I'll put it here.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7632507032661921953-2504513275061181978?l=thoughtsattheworld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thoughtsattheworld.blogspot.com/feeds/2504513275061181978/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thoughtsattheworld.blogspot.com/2005/03/windowmaker-themes.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7632507032661921953/posts/default/2504513275061181978'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7632507032661921953/posts/default/2504513275061181978'/><link rel='alternate' type='text/html' href='http://thoughtsattheworld.blogspot.com/2005/03/windowmaker-themes.html' title='Windowmaker Themes'/><author><name>Shyam</name><uri>http://www.blogger.com/profile/08673908243392570530</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7632507032661921953.post-5920827160928361176</id><published>2005-03-31T06:10:00.000-08:00</published><updated>2009-04-15T10:34:06.689-07:00</updated><title type='text'>OpenGl Makefile</title><content type='html'>While doing Computer Graphics i spent a lot of time on a Makefile. I am putting a sample one here. Might help you some day ....&lt;br /&gt;==============================================&lt;br /&gt;CC=g++ -w -pg&lt;br /&gt;&lt;br /&gt;GL_INC_DIR=/usr/include&lt;br /&gt;GL_LIB_DIR=/usr/lib&lt;br /&gt;X_LIB_DIR=/usr/X11R6/lib&lt;br /&gt;&lt;br /&gt;GL_LIBS=-L$(GL_LIB_DIR) -lglut -lGLU -lGL&lt;br /&gt;X_LIBS=-L$(X_LIB_DIR) -lXmu -lX11 -lXi&lt;br /&gt;&lt;br /&gt;CFLAGS = -Wall&lt;br /&gt;&lt;br /&gt;.PHONY:clean&lt;br /&gt;&lt;br /&gt;OBJ = colorcube.o&lt;br /&gt;LIBS = -L $(GL_LIB_DIR) $(GL_LIBS) $(X_LIBS)&lt;br /&gt;&lt;br /&gt;all: $(OBJ) colorcube&lt;br /&gt;&lt;br /&gt;$(OBJ): %.o : %.cpp&lt;br /&gt;    $(CC) -c $(CFLAGS) $&lt; -o $@&lt;br /&gt;&lt;br /&gt;colorcube: $(OBJ)&lt;br /&gt;    $(CC) $(OBJ) $(LIBS) -o $@&lt;br /&gt;&lt;br /&gt;clean:&lt;br /&gt;    rm -f  ./*~ ./core $(OBJ)&lt;br /&gt;&lt;br /&gt;#DO NOT DELETE&lt;br /&gt;colorcube.o : colorcube.h&lt;br /&gt;===============================================&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7632507032661921953-5920827160928361176?l=thoughtsattheworld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thoughtsattheworld.blogspot.com/feeds/5920827160928361176/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thoughtsattheworld.blogspot.com/2005/03/opengl-makefile.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7632507032661921953/posts/default/5920827160928361176'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7632507032661921953/posts/default/5920827160928361176'/><link rel='alternate' type='text/html' href='http://thoughtsattheworld.blogspot.com/2005/03/opengl-makefile.html' title='OpenGl Makefile'/><author><name>Shyam</name><uri>http://www.blogger.com/profile/08673908243392570530</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7632507032661921953.post-6938322753787400652</id><published>2005-03-31T06:06:00.000-08:00</published><updated>2009-04-15T10:34:23.217-07:00</updated><title type='text'>Command Prompt</title><content type='html'>To customise your command prompt display add these lines into the end of your .bachrc&lt;br /&gt;PS1="System-\h/\d/\t $ "&lt;br /&gt;\h stands for host&lt;br /&gt;\d stands for day&lt;br /&gt;\t stands for time&lt;br /&gt;&lt;br /&gt;This makes my display look like&lt;br /&gt;&lt;br /&gt;System-kamod/Thu Mar 31/19:38:05 $&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7632507032661921953-6938322753787400652?l=thoughtsattheworld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thoughtsattheworld.blogspot.com/feeds/6938322753787400652/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thoughtsattheworld.blogspot.com/2005/03/command-prompt.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7632507032661921953/posts/default/6938322753787400652'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7632507032661921953/posts/default/6938322753787400652'/><link rel='alternate' type='text/html' href='http://thoughtsattheworld.blogspot.com/2005/03/command-prompt.html' title='Command Prompt'/><author><name>Shyam</name><uri>http://www.blogger.com/profile/08673908243392570530</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7632507032661921953.post-8909388968080814669</id><published>2005-03-31T06:04:00.000-08:00</published><updated>2009-04-15T10:34:23.217-07:00</updated><title type='text'>Unlocking in Use profile in Mozilla</title><content type='html'>Many times when you logout of linux while using mozilla your profile remains 'in use'. An easy way to use it again is to go into .mozilla directory and in your profile folder and remove the file named 'lock' there.&lt;br /&gt;cd .mozilla&lt;br /&gt;cd Shubham&lt;br /&gt;cd mbhht9k3.slt&lt;br /&gt;rm lock&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7632507032661921953-8909388968080814669?l=thoughtsattheworld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thoughtsattheworld.blogspot.com/feeds/8909388968080814669/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thoughtsattheworld.blogspot.com/2005/03/unlocking-in-use-profile-in-mozilla.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7632507032661921953/posts/default/8909388968080814669'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7632507032661921953/posts/default/8909388968080814669'/><link rel='alternate' type='text/html' href='http://thoughtsattheworld.blogspot.com/2005/03/unlocking-in-use-profile-in-mozilla.html' title='Unlocking in Use profile in Mozilla'/><author><name>Shyam</name><uri>http://www.blogger.com/profile/08673908243392570530</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7632507032661921953.post-2301989966631126175</id><published>2005-03-31T05:58:00.000-08:00</published><updated>2009-04-15T10:34:23.217-07:00</updated><title type='text'>A guide into CSE</title><content type='html'>While doing engineering at Computer Science and Engineering in IIT Delhi, it occurred to me that all the things on which I spend hours on the net searching can be put into once page. I am dedicating this page to all such things.&lt;br /&gt;If you visit this and are reading this, hope you like it.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7632507032661921953-2301989966631126175?l=thoughtsattheworld.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thoughtsattheworld.blogspot.com/feeds/2301989966631126175/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thoughtsattheworld.blogspot.com/2005/03/guide-into-cse.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7632507032661921953/posts/default/2301989966631126175'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7632507032661921953/posts/default/2301989966631126175'/><link rel='alternate' type='text/html' href='http://thoughtsattheworld.blogspot.com/2005/03/guide-into-cse.html' title='A guide into CSE'/><author><name>Shyam</name><uri>http://www.blogger.com/profile/08673908243392570530</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
