Thursday, December 21, 2006

CRC32 implementation

The basic concept of a CRC is that you treat your bit-string abcdefg... as a ludicrously long polynomial M=a+bx+cx^2+dx^3+... over Z[2]. You then take a modulus polynomial P, and compute the remainder of M on division by P. Thus, an erroneous message N will only have the same CRC if the difference E = M-N is an exact multiple of P. (Note that as we are working over Z[2], M-N = N-M = M+N; but that's not very important.)

What makes the CRC good is choosing P to have good properties:
  • If its first and last terms are both nonzero then it cannot be a factor of any single term x^i. Therefore if M and N differ by exactly one bit their CRCs will guaranteeably be distinct.

  • If it has a prime (irreducible) factor with three terms then it cannot divide a polynomial of the form x^i(1+x^j). Therefore if M and N differ by exactly _two_ bits they will have different CRCs.

  • If it has a factor (x+1) then it cannot divide a polynomial with an odd number of terms. Therefore if M and N differ by _any odd_ number of bits they will have different CRCs.

  • If the error term E is of the form x^iB(x) where B(x) has order less than P (i.e. a short _burst_ of errors) then P cannot divide E (since no polynomial can divide a shorter one), so any such error burst will be spotted.

The CRC32 standard polynomial is
x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x^1+x^0

In fact, we don't compute M mod P; we compute Mx^32 mod P.

The concrete implementation of the CRC is this: we maintain at all times a 32-bit word which is the current remainder of the polynomial mod P. Whenever we receive an extra bit, we multiply the existing remainder by x, add (XOR) the x^32 term thus generated to the new x^32 term caused by the incoming bit, and remove the resulting combined x^32 term if present by replacing it with (P-x^32).

Bit 0 of the word is the x^31 term and bit 31 is the x^0 term. Thus, multiplying by x means shifting right. So the actual algorithm goes like this:

x32term = (crcword & 1) ^ newbit;
crcword = (crcword >> 1) ^ (x32term 0xEDB88320);

In practice, we pre-compute what will happen to crcword on any given sequence of eight incoming bits, and store that in a table which we then use at run-time to do the job:

outgoingplusnew = (crcword & 0xFF) ^ newbyte;
crcword = (crcword >> 8) ^ table[outgoingplusnew];

where table[outgoingplusnew] is computed by setting crcword=0 and then iterating the first code fragment eight times (taking the incoming byte low bit first).

Note that all shifts are rightward and thus no assumption is made about exact word length! (Although word length must be at _least_ 32 bits, but ANSI C guarantees this for `unsigned long' anyway.)

Tuesday, December 19, 2006

Bangalore Budget Hotels

Hotel Mahaveer
8/1 & 9, Tank Bund Road, (Near City Rly. Station), Bangalore 560 053
Rs 600 NonAC Delux double bed
Phone: 918022873670

Hotel Swagath,
75, Hospital Road, Bangalore 560 053, India
Phone: 918022877200
Non-ac: Rs 990AC: 1320

Hotel Kanishka,
IInd Main Road, Gandhinagar, Bangalore 560 009
Tel: 918022265544
Non-ac: Rs 970AC: Rs 1500

Hotel Blue Mountain
HSR Layout, Bangalore
Non-AC Deluxe Double bed room
Rent Rs 1200

Monday, December 18, 2006

Some Cool Links

At last, found some page which compiled syntax across programming languages. Nice webpage for quick reference. Cheers.

http://merd.sourceforge.net/pixel/language-study/syntax-across-languages/

You always thought there would be an easy way out to create rounded corner images. There you are..

http://www.roundedcornr.com/

Sunday, December 17, 2006

Syntax across programming languages

At last, found some page which compiled syntax across programming languages. Nice webpage for quick reference. Cheers.

http://merd.sourceforge.net/pixel/language-study/syntax-across-languages/

Friday, December 15, 2006

Cool CSS, Javascript, DHTML Utilities Links

Tab menu
Demo: http://www.dhtmlgoodies.com/scripts/dhtmlgoodies-tabmenu/dhtmlgoodies-tabmenu-images.html
Demo: http://www.dhtmlgoodies.com/scripts/dhtmlgoodies-tabmenu/dhtmlgoodies-tabmenu.html
Info and download link:
http://www.dhtmlgoodies.com/index.html?whichScript=dhtmlgoodies_tabmenu


DHTML Modal Dialog Script
This script displays a modal message at the center of the screen. All other page controls are disabled until the message is closed. You can choose between displaying static content inside the message box or content from an external file.
Demo: http://www.dhtmlgoodies.com/scripts/modal-message/demo-modal-message.html
Info and download: http://www.dhtmlgoodies.com/index.html?whichScript=modal-message


DHTML Rounded Corners
Demo: http://www.dhtmlgoodies.com/scripts/rounded-corners/rounded-corners.html
Info and Download: http://www.dhtmlgoodies.com/index.html?whichScript=rounded-corners


Text scroller/Scrolling content
A simple text scroller script. Use this script to add one or more boxes of scrolling text to your page.
Info and download: http://www.dhtmlgoodies.com/index.html?whichScript=scrolling_content
Demo: http://www.dhtmlgoodies.com/scripts/scrolling-content/scrolling-content.html


Show/Hide content (Could be used in FAQ)
A simple script for questions and answers. Click on the questions, and the answer will drop down right below it.
Info and download: http://www.dhtmlgoodies.com/index.html?whichScript=show_hide_content
Demo: http://www.dhtmlgoodies.com/scripts/show-hide-content/show-hide-content.html


DHTML Ballon Tooltip
Info and download: http://www.dhtmlgoodies.com/index.html?whichScript=bubble_tooltip
Demo: http://www.dhtmlgoodies.com/scripts/bubble_tooltip/bubble_tooltip.html



Tooltip for forms
Displays a tooltip next to form elements when the element receives focus.
Info and download : http://www.dhtmlgoodies.com/index.html?whichScript=form-field-tooltip
Demo : http://www.dhtmlgoodies.com/scripts/form-field-tooltip/form-field-tooltip.html


Vertical menu/Horizontal menu
http://www.dynamicdrive.com/style/csslibrary/item/suckertree-menu-vertical/
http://www.dynamicdrive.com/style/csslibrary/item/slanted-divider-menu/
http://www.dynamicdrive.com/style/csslibrary/item/shade-image-tabs-menu/

Dynamically Loading Tab
http://developer.yahoo.com/yui/examples/tabview/loading.html


Yahoo UI Library (Refer it for general UI widgets)
http://developer.yahoo.com/yui/

Grouped Side Nav
http://developer.yahoo.com/yui/examples/menu/example05.html
http://developer.yahoo.com/yui/examples/menu/example06.html

Horizontal 2 Level tab Menu (Check it out)
http://www.javascriptkit.com/script/script2/2leveltab.shtml

Highlighting Form Element
http://www.dynamicdrive.com/dynamicindex11/highlightform.htm

Tools used to run and build 37 signals
http://www.37signals.com/svn/archives2/the_tools_we_use_to_run_and_build_37signals.php

Thursday, December 14, 2006

Top 6 tips for an aspirant enterpreneur

  • Entrepreneurship: It's not a business plan, it's a calling

  • Entrepreneurship is all about passion

  • Change. It's the only constant.

  • Be the water that cuts the rock

  • Before you build a business, build a network

  • The key thing is to believe in your ability

Top 5 ways to beat boredom in one's life

  • Catch up with the latest songs from your favorite bands, album, movies etc.

  • Catch up with latest news, articles of your interest.

  • Catch up with latest movies.

  • Write blogs on latest stuff showing likes and dislikes.

  • Stay in touch with your buddies and catch up latest in their lives. Concentrate on increase your networking as that pays dividend in the future.

Tuesday, December 12, 2006

Online Calculator Calc5.com

This one is really cool. I ended up uninstalling calculator from my desktop and was frustrated whenever I had to do some quick calculations. I found a online web calculator http://www.calc5.com which is tool cool to be. Good going guys.

Google kind of innovation needed?

Social Networking websites have flocked in large numbers with none of them been google type innovation. Do we need innovation in social networking space? Yes, there is a site http://www.orkut.com and there are various others. But, do they really provide enough compelling tools and services to empower social networking? I do not think so.

I firmly believe that it is just search which has seen Google.com. Other spaces still need google kind of innovation. So, creative minds out there, keep brain-storming.:)

Monday, December 11, 2006

Web Developer's Heaven

Collection of best top 10 open source, AJAX/DHTML libraries for Web developer. I found them very useful. May be you would want to try out one of them. It is always good to reuse the tools than to reinvent the wheel and waste time and energy. God bless the open source free tool developers.:)

http://ashko.blogspot.com/2006/11/best-top-ten-open-sourceajaxdhtml.html

Some of the cool stuff I found today on net

1. http://stommel.tamu.edu/~baum/programming.html
Resource to 3000 programming texts and tutorials. This one is really cool page. Thanks to the author for all the hardwork.

2. http://www.google.com/reader
A nice rss reader. I just love it. It has reduced lot of pain associated with visiting my daily web pages. I am now very much relaxed.

3. http://math.arizona.edu/~kerl/doc/square-root.html
How to manually find a square root. This one is cool trick for finding square root of any number.

Quiz for the day: Who coined the big famous tech word AJAX?
Answer: Jesse James Garrett

Blogging Tips - 29 Topics and Sentence Starters for Your Next Blog

  • Press releases- making new announcements

  • Thoughts for the day

  • Product comparisons

  • Opinions on a topic

  • Promoting your product or service

  • Sharing thoughts about a recent study

  • Giving links to other similar products

  • Asking people to try a product

  • Sharing positive or negative customer service experiences

  • Providing consultation services

  • Providing information regarding your area, traveling and other related information

  • Giving creative ideas about your business

  • Sharing information on local events or industry tradeshows

  • Latest news

  • Providing tips, FAQs and support

  • Providing updates about changes in your website

  • Providing information about projects and their status reports

  • Crisis management

  • Explaining how a typical client would use your product or service

  • Improvements in your product

  • Talk about your pet

  • Getting feedback from the customers

  • Information exchange

Tuesday, December 05, 2006

Google Tips or Security Tips

Are they Security tips or Google tips? Well, I was reading an article in http://www.itworld.com wherein they mentioned about three google searches you must know. They are as following:
 
  1. site:xxx.com
  2. filetype:yyy site:xxx.com
  3. link:xxx.com
Well, I am not sure if they really are useful to hackers. But, yes the filetype:yyy is a really useful one. Say, how?
 
Lets say, I am looking for XML Tutorial. If I search google with XML Tutorial filetype:pdf
the search result only contains pdf file. This is a useful tip as I could straight away filter the result. For a detailed article, read the following:
 
cheers
 


Any questions? Get answers on any topic at Yahoo! Answers. Try it now.

Friday, December 01, 2006

Music Therapy: Effect of Music on human body

 
Following is taken from link below:
 
Those suffering from nausea and vomiting:
Researchers have found that music therapy used along with anti-nausea drugs for patients receiving high-dose chemotherapy can help ease nausea and vomiting. Does that mean that those suffering from regular menier's attack could get some benefit. I will try.:) At least , it would help me to not think about my next attack.:) and then, yes, I definitely experience a significant reduction in nausea and vomiting tendency in last three days.
 
Other clinical trials have revealed a reduction in heart rate, blood pressure, breathing rate, insomnia, depression, and anxiety with music therapy. No one knows all the ways music can benefit the body, but studies have shown that music can affect brain waves, brain circulation, and stress hormones as well.
 
 
There is one other useful link which is as following and which says Music reverses Alzheimer's disease:
 
 
And then the following one:

Menier's disease: Yoga and Music Therapy

I am suffering from Menier's disease. Having tried all form of medicines, I am still struggling to find out if there is one or more form of sureshot cure or say, a defintive treatment for menier's disease.
 
It looks like I would have to try some wild alternatives and some cool alternatives to figure out if menier's disease could be cured. Why should I believe doctors and wriiten articles that there is no definitive treatment for menier's disease.
 
In coming days, I am going to try following:
 
Yoga therapy
Music therapy (Already trying. It has seriously improved my situation since last three days. touchwood!)
 
Lets see how it shapes up.:)
 
cheers
Take a look at following link: