Sorting algorithm- Quicksort

21 Apr 2009 In: Algorithm

Quicksort is one of the fastest and simplest sorting algorithms [Hoa 62]. It works recursively by a divide-and-conquer strategy.

The quicksort is considered to be very efficient, with its “divide and conquer” algorithm. This sort starts by dividing the original array into two sections (partitions) based upon the value of the first item in the array. Since our example sorts into descending order, the first section will contain all the elements with values greater than the first item. Read the rest of this entry »

Top 50 CSS Menus and Navigations

20 Apr 2009 In: Bookmarks, CSS

Navigation menus have to be intuitive, precise and easy-to-use. One simple, basic principle, which is common for all kinds of nav bars you would ever want to use for your projects.

You’ll find 50 user-friendly CSS based menu and navigation solutions.

  1. 11 CSS navigation menus : at Exploding Boy
  2. 12 more CSS Navigation Menus. : at Exploding Boy
  3. 14 Free Vertical CSS Menus : at Exploding Boy
  4. 2-level horizontal navigation : demo at Duoh
  5. Absolute Lists: Alternatives to Divs : An approach of using lists instead of divs at evolt
  6. Accessible Image-Tab Rollovers : demo at Simplebits
  7. ADxMenu : multiple menu examples at aPlus Read the rest of this entry »

How to write a better title

9 Apr 2009 In: SEO

Titles are everywhere. Some people are defined by titles, some people loathe titles, and others like giving titles. Why do we do this? With so much information getting processed by our minds everyday, we need a way to categorize these groups of associated content in a quick referencing way.

This is the same methodology a search engine applies when it crawls a page. When you title a page, you are telling a search engine or user what the page is supposed to be about. We’ve all seen the one sentence summaries of television shows on the T.V. Guide. It allows for quick referencing and decision making by telling us what the show is going to be about.
Read the rest of this entry »

Deleting dublicated rows in MySQL

9 Apr 2009 In: MySQL

To find duplicate values you need to use the MySQL COUNT() function and then pick out all of the counts that are greater than one.

SELECT VALUE,COUNT(VALUE) AS COUNT
FROM test
GROUP BY VALUE
HAVING (COUNT(VALUE) > 1)
ORDER BY COUNT DESC;

Conversely you can also select the rows that only have a single entry. Read the rest of this entry »

Fix Wrong Character Encoding In MySQL

8 Apr 2009 In: MySQL

Sometimes, especially when moving data from one server to another, you might find that you have encoded your MySQL database incorrectly. This problem with first show itself if you have the database encoded in one charset and your website set to display in another. If this is the case then you will find strange characters appearing in your text, especially when using punctuation marks. If you are unable or unwilling to change the character encoding on the site then you need to change how the data is encoded in the database.

The most common sort of thing you might want to do is change from iso-8859-1 (or windows-1252) to UTF-8. This can be done in one of two ways.
Read the rest of this entry »

Dijkstra’s algorithm

7 Apr 2009 In: Algorithm

dijksta
Dijkstra’s algorithm, conceived by Dutch computer scientist Edsger Dijkstra in 1959, is a graph search algorithm that solves the single-source shortest path problem for a graph with nonnegative edge path costs, producing a shortest path tree. This algorithm is often used in routing.

Algorithm

Let’s call the node we are starting with an initial node. Let a distance of a node X be the distance from the initial node to it. Dijkstra’s algorithm will assign some initial distance values and will try to improve them step-by-step. Read the rest of this entry »

Facebook like auto complete input

7 Apr 2009 In: Ajax

If you used Facebook on a regularly basis, you’ve probably come across their cool autocomplete method of adding multiple recipients to messages. For those that haven’t seen it, here’s a pic:

rb_facebook

Guillermo Rauch set out to build something similar and he did a very good job of mimicking this behavior using MooTools v1.2:

Findout users real IP

7 Apr 2009 In: PHP

The failing in using the value of $_SERVER['REMOTE_ADDR'] is that if the visitor is using a proxy then you will get the proxy IP address and not the visitors real IP address.

This function works by going through any variables in the $_SERVER array that might exist that would contain information to do with IP addresses. If they are all empty then the function finally looks at $_SERVER['REMOTE_ADDR'] value and returns this as a default.

function getRealIpAddr(){
 if ( !empty($_SERVER['HTTP_CLIENT_IP']) ) {
  //check ip from share internet
  $ip = $_SERVER['HTTP_CLIENT_IP'];
 } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR']) ) {
  //to check ip is pass from proxy
  $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
 } else {
  $ip = $_SERVER['REMOTE_ADDR'];
 }
 return $ip;
}

To run this function just call it.

echo getRealIpAddr();

This function was originally found here.

Check user referer

7 Apr 2009 In: PHP

It is sometimes a good idea to find out where users can come from. When PHP is run the $_SERVER superglobal is always available and if the user has clicked on a link and landed on your page then the HTTP_REFERER value will be set. You can retrieve it like this.

if ( isset($_SERVER[ HTTP_REFERER ]) ) {
 echo $_SERVER['HTTP_REFERER'];
}

Of course you might want to do something useful with this. For example, you might want to know what link a user clicked on when they broke your application.

PHP find file extension

7 Apr 2009 In: PHP

This simple code example uses a combination of strrchr to find the last occurrence of a string and substr to return part of the string in order to find the file extension for a given filename. This is ideal if you want to quickly find a file extension.

$ext = substr(strrchr($fileName, '.'), 1);

This code can be used in the following way.

$fileName = '\path\to\file\afile.jpg';
$ext = substr(strrchr($fileName, '.'), 1);
echo $ext;

The output here is ‘jpg’;

1. http://abell.as.arizona.edu/~hill/cgi-bin/webglimpse.cgi/home/hill/public_html/4x4?query=%22%3E%3Ca+href%3Dhttp%3A%2F%2Fwww.rollondoc.com%3ELink%3C%2Fa%3E&errors=0&age=&maxfiles=50&maxlines=30&cache=yes 2. http://aboutdomain.org/info/www.rollondoc.com/ 3. http://aboutus.org/www.rollondoc.com 4. http://alexa.com/siteinfo/www.rollondoc.com 5. http://backlinkcheck.com/popular.pl?url1=www.rollondoc.com&cache=yes 6. http://backtype.com/url/www.rollondoc.com&cache=yes 7. http://browsershots.org/http://www.rollondoc.com 8. http://builtwith.com/?www.rollondoc.com 9. http://checkdomain.com/cgi-bin/checkdomain.pl?domain=www.rollondoc.com&cache=yes 10. http://childstats.gov/disclaim.asp?URL=http://www.www.rollondoc.com&cache=yes 11. http://ciac.llnl.gov/cgi-bin/webglimpse/www/htdocs/ciac/archive?query=%22%3E%3Ca+href%3Dhttp%3A%2F%2Fwww.rollondoc.com%3ELinks%3C%2Fa%3E&errors=0&age=&maxfiles=50&maxlines=30&cache=yes 12. http://cnm.edu/extlink.php?link=http://www.rollondoc.com 13. http://cqcounter.com/rbl_check/?query=www.rollondoc.com&cache=yes 14. http://cqcounter.com/siteinfo/?query=www.rollondoc.com&cache=yes 15. http://cqcounter.com/traceroute/?query=www.rollondoc.com&cache=yes 16. http://cubestat.com/www.rollondoc.com&cache=yes 17. http://democrats.assembly.ca.gov/members/scripts/redirect.asp?url=http://www.rollondoc.com&cache=yes 18. http://domains.whois.com/domain.php?action=whois&query=www.rollondoc.com 19. http://esitestats.com/www.rollondoc.com&cache=yes 20. http://export.gov/wcm/fragments/fl_eg_outsidelinks/redirect.asp?URL=http://www.rollondoc.com&cache=yes 21. http://www.fairfaxcounty.gov/offsite/?pg=http://www.rollondoc.com 22. http://www.fbi.gov/cgi-bin/outside.cgi?http://www.rollondoc.com 23. http://www.fcc.gov/fcc-bin/bye?http://www.rollondoc.com 24. http://feedest.com/feedHost.cfm/host/www.rollondoc.com&cache=yes 25. http://find-ip-address.org/whois/mrwhois_details.php?ddomain=www.rollondoc.com&server=whois.opensrs.net 26. http://www.fmc.gov/home/offsite.asp?URL=http://www.rollondoc.com&cache=yes 27. http://grader.com/site.php?URL=www.rollondoc.com&cache=yes 28. http://home.nps.gov/applications/redirect/?sUrl=http://www.rollondoc.com 29. http://hosts-file.net/?s=www.rollondoc.com&cache=yes 30. http://ip-adress.com/whois/www.rollondoc.com&cache=yes 31. http://iwebtool.com/pagerank_checker?domain=www.rollondoc.com 32. http://marad.dot.gov/exit.asp?type=1&url=www.rollondoc.com&cache=yes 33. http://markosweb.com/www/www.rollondoc.com/ 34. http://milonic.com/whois.php?domain=www.rollondoc.com&ref=&WebServer= 35. http://www.minfin.gov.by/search/?action=index&text=%22%22%3E%3Ca+href%3Dhttp%3A%2F%2Fwww.rollondoc.com%2F%3ELink%3C%2Fa%3E%3C%22 36. http://namedroppers.com/who/www.rollondoc.com 37. http://ncsacw.samhsa.gov/offsite.asp?url=http://www.rollondoc.com&cache=yes 38. http://netvaluer.com/show.asp?site=www.rollondoc.com&cache=yes 39. http://networksolutions.com/whois-search/www.rollondoc.com&cache=yes 40. http://network-tools.com/default.asp?prog=whois&host=www.rollondoc.com&cache=yes 41. http://nws.noaa.gov/cgi-bin/nwsexit.pl?url=http://www.rollondoc.com&cache=yes 42. http://nsf.gov/cgi-bin/good-bye?http://www.rollondoc.com 43. http://nps.gov/cgi-bin/intercept?http://www.rollondoc.com 44. http://opic.gov/leaving.asp?url=http://www.rollondoc.com&cache=yes 45. http://oceanservice.noaa.gov/cgi-bin/redirout.cgi?url=http://www.rollondoc.com&cache=yes 46. http://page2rss.com/page?url=www.rollondoc.com/ 47. http://pageheat.com/heat/www.rollondoc.com 48. http://protect-x.com/info/www.rollondoc.com&cache=yes 49. http://quantcast.com/www.rollondoc.com 50. http://quantcast.com/profile/no-data-for-site?domain=www.rollondoc.com&cache=yes 51. http://quarkbase.com/show/www.rollondoc.com 52. http://quest.nasa.gov/cgi-bin/glimpse2/webglimpse.cgi?ID=1&cache=yes&query=%22%3E%3Ca+href%3Dhttp%3A%2F%2Fwww.rollondoc.com%3Links%3C%2Fa%3E&errors=0&age=&maxfiles=50&maxlines=30&cache=yes 53. http://ratite.com//whois/whois.cgi?domain=www.rollondoc.com&cache=yes 54. http://registrar.verisign-grs.com/cgi-bin/whois?whois_nic=www.rollondoc.com&x=60&y=12&type=domain&cache=yes 55. http://rehab.alabama.gov/Home/Misc/Redirect.aspx?url=http://www.rollondoc.com&cache=yes 56. http://ram3.chem.sunysb.edu/cgi-bin/webglimpse.cgi?ID=2&query=%22%3E%3Ca+href%3Dhttp%3A%2F%2Fwww.rollondoc.com%3ELinks%3C%2Fa%3E&rankby=DEFAULT&errors=0&age=&maxfiles=20&maxlines=10&maxchars=2000&cache=yes 57. http://reports.internic.net/cgi/whois?whois_nic=www.rollondoc.com&type=domain&cache=yes 58. http://robotics.nasa.gov/rcc/redirect.php?url=%2F%2Fwww.rollondoc.com&cache=yes 59. http://roc.noaa.gov/scripts/exit/osfexit.pl?url=http://www.rollondoc.com&cache=yes 60. http://robtex.com/dns/www.rollondoc.com.html 61. http://seoarena.org/sh/www.rollondoc.com/ 62. http://siteadvisor.cn/sites/www.rollondoc.com/summary/&cache=yes 63. http://siteadvisor.cn/sites/www.rollondoc.com 64. http://siteanalytics.compete.com/www.rollondoc.com 65. http://sitedossier.com/site/www.rollondoc.com&cache=yes 66. http://sitetiki.com/www.rollondoc.com&cache=yes 67. http://snapnames.com/?aff=321&dom=www.rollondoc.com&cache=yes 68. http://spacereg.com/a.rpl?m=whois&domain=www.rollondoc.com&cache=yes 69. http://statbrain.com/www.rollondoc.com&cache=yes 70. http://statsaholic.com/www.rollondoc.com&cache=yes 71. http://tampafl.gov/common/redirect.asp?redirect=www.rollondoc.com/&cache=yes 72. http://tgsc.ru/redirect/http://www.rollondoc.com&cache=yes 73. http://toolbar.netcraft.com/site_report?url=http://www.rollondoc.com&cache=yes 74. http://www.transtats.bts.gov/exit.asp?url=http://www.rollondoc.com&cache=yes 75. http://tweetmeme.com/domain/www.rollondoc.com 76. http://uk1.co.uk/cgi-bin/cart/cart.cgi?typeofsearch=rawwhois&domain=www.rollondoc.com&server=whois.nic.uk&cache=yes 77. http://uptime.netcraft.com/up/graph?site=www.rollondoc.com&cache=yes 78. http://urladex.com/index.py?page=url&url=www.rollondoc.com&cache=yes 79. http://urltrends.com/viewtrend.php?url=www.rollondoc.com&cache=yes 80. http://websiteaccountant.com/www.rollondoc.com&cache=yes 81. http://websiteoutlook.com/www.www.rollondoc.com&cache=yes 82. http://whois.webhosting.info/www.rollondoc.com 83. http://www.weather.gov/cgi-bin/nwsexit.pl?url=http://www.rollondoc.com&cache=yes 84. http://whatismyip.com.np/whois.php?query=www.rollondoc.com&cache=yes 85. https://who.securepaynet.net/whoischeck.aspx?ci=14582&domain=www.rollondoc.com&prog_id=enet_world&cache=yes 86. http://who.godaddy.com/whoischeck.aspx?Domain=www.rollondoc.com&cache=yes 87. http://who.is/whois/www.rollondoc.com/&cache=yes 88. http://whois.domainpeople.com/whois.cgi?domain=www.rollondoc.com&cache=yes 89. http://whois.domaintools.com/www.rollondoc.com&cache=yes 90. http://whois.net/whois/www.rollondoc.com&cache=yes 91. http://whois.tools4noobs.com/info/www.rollondoc.com&cache=yes 92. http://whoisbeta.com/index.php?query=www.rollondoc.com&cache=yes 93. http://whoisbucket.com/view/www.rollondoc.com&cache=yes 94. http://whoisd.com/search.php?code=2119&domain=www.rollondoc.com&GO=GO 95. http://whoisn.com/lookup.php?domain=www.rollondoc.com&button1=Check&cache=yes 96. http://whois-search.com/whois/www.rollondoc.com&cache=yes 97. http://whoisx.co.uk/www.rollondoc.com&cache=yes 98. http://whoisya.com/www.rollondoc.com&cache=yes 99. http://workforcesecurity.doleta.gov/foreign/redirect.asp?link=www.rollondoc.com/&cache=yes 100. http://www2.scc.rutgers.edu/ead/showfile.php?filename=http://www.rollondoc.com&cache=yes 101. http://www3.mt.gov.br/redirect.php?url=//www.rollondoc.com/&cache=yes 102. http://www-nrd.nhtsa.dot.gov/utility/direct.asp?url=http://www.rollondoc.com&cache=yes 103. http://xmarks.com/site/www.rollondoc.com/&cache=yes 104. http://zoneedit.com/whois.html?zone=www.rollondoc.com&cache=yes