<?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:blogger='http://schemas.google.com/blogger/2008' 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-1887130166514683270</id><updated>2024-10-08T19:05:05.583-07:00</updated><category term="MySQL"/><category term="PHP"/><category term="SEO"/><category term="Ubuntu"/><title type='text'>Php Developer</title><subtitle type='html'>Information for virtual Web Technologies</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://sireeshnaidu.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1887130166514683270/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://sireeshnaidu.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>6</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1887130166514683270.post-1412014421088333774</id><published>2010-03-31T04:54:00.000-07:00</published><updated>2010-03-31T04:55:17.883-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="PHP"/><title type='text'>PHP Tips &amp; Tricks</title><content type='html'>&lt;b&gt;Please use the below Tips at the time of developing a code.&lt;/b&gt;&lt;br /&gt;
1. If a method can be static, declare it static. Speed improvement is by a factor of 4.&lt;br /&gt;
2. echo is faster than print.&lt;br /&gt;
3. Use echo&#39;s multiple parameters instead of string concatenation.&lt;br /&gt;
4. Set the maxvalue for your for-loops before and not in the loop.&lt;br /&gt;
5. Unset your variables to free memory, especially large arrays.&lt;br /&gt;
6. Avoid magic like __get, __set, __autoload.&lt;br /&gt;
7. require_once() is expensive.&lt;br /&gt;
8. Use full paths in includes and requires, less time spent on resolving the OS paths.&lt;br /&gt;
9. If you need to find out the time when the script started executing, $_SERVER[&#39;REQUEST_TIME&#39;] is preferred to time().&lt;br /&gt;
10. use regex  instead of strncasecmp, strpbrk and stripos .&lt;br /&gt;
11. str_replace is faster than preg_replace, but strtr is faster than str_replace by a factor of 4.&lt;br /&gt;
12. If the function, such as string replacement function, accepts both arrays and single characters as arguments, and if your argument list is not too long, consider writing a few redundant replacement statements, passing one character at a time, instead of one line of code that accepts arrays as search and replace arguments.&lt;br /&gt;
13. It&#39;s better to use switch statements than multi if, else if, statements.&lt;br /&gt;
14. it’s better to use conditional statement instead of if else statements.&lt;br /&gt;
15. Error suppression with @ is very slow.&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
16. Turn on apache&#39;s mod_deflate.&lt;br /&gt;
17. Close your database connections when you&#39;re done with them.&lt;br /&gt;
18. $row[&#39;id&#39;] is 7 times faster than $row[id].&lt;br /&gt;
19. Error messages are expensive.&lt;br /&gt;
20. Do not use functions inside of for loop, such as for ($x=0; $x &amp;lt; count($array); $x) The count() function gets called each time. 21. Incrementing a local variable in a method is the fastest. Nearly the same as calling a local variable in a function. 22. Incrementing a global variable is 2 times slow than a local var. 23. Incrementing an object property (eg. $this-&amp;gt;prop++) is 3 times slower than a local variable.&lt;br /&gt;
24. Incrementing an undefined local variable is 9-10 times slower than a pre-initialized one.&lt;br /&gt;
25. Just declaring a global variable without using it in a function also slows things down (by about the same amount as incrementing a local var). PHP probably does a check to see if the global exists.&lt;br /&gt;
26. Method invocation appears to be independent of the number of methods defined in the class because I added 10 more methods to the test class (before and after the test method) with no change in performance.&lt;br /&gt;
27. Methods in derived classes run faster than ones defined in the base class.&lt;br /&gt;
28. A function call with one parameter and an empty function body takes about the same time as doing 7-8 $localvar++ operations. A similar method call is of course about 15 $localvar++ operations.&lt;br /&gt;
29. Surrounding your string by &#39; instead of &quot; will make things interpret a little faster since php looks for variables inside &quot;...&quot; but not inside &#39;...&#39;. Of course you can only do this when you don&#39;t need to have variables in the string.&lt;br /&gt;
30. When echoing strings it&#39;s faster to separate them by comma instead of dot. Note: This only works with echo, which is a function that can take several strings as arguments. &lt;br /&gt;
31. A PHP script will be served at least 2-10 times slower than a static HTML page by Apache. Try to use more static HTML pages and fewer scripts.&lt;br /&gt;
32. Your PHP scripts are recompiled every time unless the scripts are cached. Install a PHP caching product to typically increase performance by 25-100% by removing compile times.&lt;br /&gt;
33. Cache as much as possible. Use memcached - memcached is a high-performance memory object caching system intended to speed up dynamic web applications by alleviating database load. OP code caches are useful so that your script does not have to be compiled on every request&lt;br /&gt;
34. When working with strings and you need to check that the string is either of a certain length you&#39;d understandably would want to use the strlen() function. This function is pretty quick since it&#39;s operation does not perform any calculation but merely return the already known length of a string available in the zval structure (internal C struct used to store variables in PHP). However because strlen() is a function it is still somewhat slow because the function call requires several operations such as lowercase &amp;amp; hashtable lookup followed by the execution of said function. In some instance you can improve the speed of your code by using an isset() trick.&lt;br /&gt;
&lt;i&gt;&lt;b&gt;Ex:-&lt;/b&gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;if (strlen($foo) &amp;lt; 5) { echo &quot;Foo is too short&quot;; }&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;vs.&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;if (!isset($foo{5})) { echo &quot;Foo is too short&quot;; }&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
Calling isset() happens to be faster then strlen() because unlike strlen(), isset() is a language construct and not a function meaning that it&#39;s execution does not require function lookups and lowercase. This means you have virtually no overhead on top of the actual code that determines the string&#39;s length.&lt;br /&gt;
35. When incrementing or decrementing the value of the variable $i++ happens to be a tad slower then ++$i. This is something PHP specific and does not apply to other languages, so don&#39;t go modifying your C or Java code thinking it&#39;ll suddenly become faster, it won&#39;t. ++$i happens to be faster in PHP because instead of 4 opcodes used for $i++ you only need 3. Post incrementation actually causes in the creation of a temporary var that is then incremented. While pre-incrementation increases the original value directly. This is one of the optimization that opcode optimized like Zend&#39;s PHP optimizer. It is a still a good idea to keep in mind since not all opcode optimizers perform this optimization and there are plenty of ISPs and servers running without an opcode optimizer.&lt;br /&gt;
36. Not everything has to be OOP, often it is too much overhead, each method and object call consumes a lot of memory. &lt;br /&gt;
37. Do not implement every data structure as a class, arrays are useful, too.&lt;br /&gt;
38. Don&#39;t split methods too much, think, which code you will really re-use.&lt;br /&gt;
39. You can always split the code of a method later, when needed.&lt;br /&gt;
40. Make use of the countless predefined functions.&lt;br /&gt;
41. If you have very time consuming functions in your code, consider writing them as C extensions.&lt;br /&gt;
42. Profile your code. A profiler shows you, which parts of your code consumes how many time. The Xdebug debugger already contains a profiler. Profiling shows you the bottlenecks in overview.&lt;br /&gt;
43. mod_gzip which is available as an Apache module compresses your data on the fly and can reduce the data to transfer up to 80%</content><link rel='replies' type='application/atom+xml' href='http://sireeshnaidu.blogspot.com/feeds/1412014421088333774/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/1887130166514683270/1412014421088333774' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1887130166514683270/posts/default/1412014421088333774'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1887130166514683270/posts/default/1412014421088333774'/><link rel='alternate' type='text/html' href='http://sireeshnaidu.blogspot.com/2010/03/php-tips-tricks.html' title='PHP Tips &amp; Tricks'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1887130166514683270.post-7123048674575974189</id><published>2010-03-31T04:30:00.000-07:00</published><updated>2010-03-31T04:35:38.660-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="SEO"/><title type='text'>Search Engine Optimization(SEO) Techniques</title><content type='html'>SEO is the process and practice of optimizing your website so that it ranks well on search engine results pages (or SERPs). When someone types a word or phrase into search engines (like Google) looking for your product, you want to appear on the first or second page of the search results.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Note:-&lt;/b&gt; some places i am using &#39;?&#39; symbol instead of&amp;nbsp; &#39;&amp;lt;&#39; symbol.Please understand question-mark as less-than symbol.(because i cant use tags inside the post)&lt;br /&gt;
Please follow the below steps to improve your website&#39;s search engine  ranking. &lt;br /&gt;
&lt;ul&gt;&lt;li&gt;&lt;b&gt;Domain &amp;amp; File Names:-&lt;/b&gt;Choose your site domain name that contains words from your primary keyword phrase. Your domain name should also be easy to spell and easy to remember. Your keyword phrase also should be a part of your file name.&lt;br /&gt;
&lt;i&gt;&lt;b&gt;Ex:- &lt;/b&gt;&lt;/i&gt;About Us page file name should be http://yourdomain.com/about-us.htm&lt;br /&gt;
&lt;i&gt;&lt;b&gt;Note:-&lt;/b&gt;&lt;/i&gt; A file with 3+ hyphens tends to look spammy and users may be hesitant to click on it. Use hyphens in URLs and file names, not underscores. Hyphens are treated as a “space,” while underscores are not.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;&amp;nbsp;Hierarchal Design:-&lt;/b&gt;The&amp;nbsp; web pages you create should be in a hierarchal design with your home page at the top of the hierarchy. Every page of your website should be reachable by at least one static link.&lt;/li&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;
&lt;li&gt; &lt;b&gt;Keyword Phrases:-&lt;/b&gt;Use keywords that are being searched for, Add keyword synonyms to your content, Put the keyword phrases in the title tag Insert the keyword phrases in a &lt;br /&gt;
?h1&amp;gt;keyword phrase?/h1&amp;gt;&lt;br /&gt;
tag at the beginning of your page. Keyword synonyms should be put in your h2 &amp;amp; h3 tags. The h1, h2, h3 tags are used for titles and subtitles in articles &amp;amp; Make sure you use your keyword phrases from the page you are linking to, in your anchor text on the site map.&lt;br /&gt;
&lt;i&gt;&lt;b&gt;Note:-&lt;/b&gt;&lt;/i&gt; Try to limit yourself to 10 keyword phrases.&lt;b&gt;&lt;br /&gt;
&lt;/b&gt; &lt;/li&gt;
&lt;li&gt;&lt;b&gt;Title &amp;amp; Meta Description Tag:-&lt;/b&gt;Construction of your title tag is one of the most important things you need to do. Each page should have a different title with 2 or 3 of your keyword phrases at the beginning. When search engine results are displayed the title is the first thing people see.&lt;br /&gt;
Below the title is a description which will be either be taken from your meta name description content=&quot;Description phrase&quot; or from the first sentence on at page. You description should also have 2 or 3 of your keyword phrases at the beginning as so should your first sentence. You should have a different title, description and first sentence on each page. You many also what to try shorter titles with only one keyword or keyword phrase as this will raise you keyword relevance. Also you can consider putting your domain name at the very end of the title. &lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;&lt;b&gt;&amp;nbsp;Meta Keywords Tag:-&lt;/b&gt;The meta keywords tag is not as relevant as it used to be and some say Google doesn&#39;t ever look at it anymore, but put it in anyway. It is as follows, ?meta name=&quot;keywords&quot; content=&quot;keywords,go,here&quot; /? and put in it all your keywords and keyword phrases. This tag should be different for each page. &lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Author &amp;amp; Robots Tags:-&lt;/b&gt;The Author Tag should contain the name of the company that owns the site. This tag will help you get a No 1 position for your company&#39;s name.&lt;br /&gt;
?meta name=&quot;author&quot; content=&quot;xyz company&quot; /&amp;gt;&lt;br /&gt;
Use a generic Robots Tag on all pages that you want indexed. This instructs the robots to crawl the page. The following is the generic robots tag.&lt;br /&gt;
?meta name=&quot;robots&quot; content=&quot;index, follow&quot; /&lt;b&gt;&amp;gt;&lt;/b&gt;&lt;/li&gt;
&lt;li&gt; &lt;b&gt;Meta copyright, revisit-after, abstract, verify-v1 Tags:-&lt;/b&gt;In The copyright meta tag you can specify the copyrights&lt;br /&gt;
?meta name=&quot;copyright&quot; content=&quot;2010 XYZ company&quot;/&amp;gt;&lt;br /&gt;
By using revist-after meta tag you can tell to spiders/crawlers how offenly can crawl your page.&lt;br /&gt;
?meta name=&quot;revisit-after&quot; content=&quot;4 days&quot;/&amp;gt;&lt;br /&gt;
&lt;i&gt;&lt;b&gt;Note:-&lt;/b&gt;&lt;/i&gt; Use this tag where usually content changes in the page.&lt;br /&gt;
By using abstract meta tag you can give brief abstract of your page&lt;br /&gt;
?meta name=&quot;abstract&quot; content=&quot;Abstract of that particular page &quot;/&amp;gt;&lt;br /&gt;
By using verify-v1 meta tag is used for Google-site-verification.&lt;br /&gt;
You can submit your site to &lt;a href=&quot;http://www.google.com/webmasters/&quot;&gt;Google webmaster&lt;/a&gt; and Google will give you verification string keep that string in verify-v1 meta tag&lt;br /&gt;
?meta name=&quot;verify-v1&quot; content=&quot;Google verification string&quot; /&amp;gt;&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Sitemap:-&lt;/b&gt;You should have a sitemap on your website. This helps crawlers/spidders learn about the structure of your site and makes every section of your website reachable. I would make one sitemap for your users and another XML sitemap for the crawlers. Make sure you submit the XML sitemap to google and yahoo using the webmaster tools.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Avoid Black Hat Techniques:-&lt;/b&gt;There are several black hat techniques such as keyword stuffing and hidden text that can temporarily give you a boost in the SERPs. However, in the long run, your website will be penalized and be even lower in the SERPs than you started out with. Stay away from these techniques.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Include a ROBOTS.TXT file on your site:-&lt;/b&gt;This tells the crawlers what parts of your site can be crawled. You should avoid making your member and admin sections crawlable.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Changing Content:-&lt;/b&gt;You can do this by hand or with a script. For example you can have a php script that draws five paragraphs from a pool of twenty paragraphs when the content is different each time the php page is accessed.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Avoid Dynamic URLs:-&lt;/b&gt;Are you pages via php or asp? Some search engines may have a problem indexing them. Create static pages whenever possible. Avoid symbols in your URLs like the &quot;?&quot; that you will often find in php or asp pages.&lt;br /&gt;
Static pages are the best but if you have a db driven site, make sure the menu and site map like go to inventory.php not inventory.php?id=0&lt;b&gt; &lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Frames:-&lt;/b&gt; Many search engines can&#39;t follow frame links. Make sure you provide an alternative method for the search engines to enter and index your site.&lt;/li&gt;
&lt;li&gt; &lt;b&gt;Separate Content &amp;amp; Presentation:-&lt;/b&gt;Put all your presentation code into Cascading Styles Sheets (CSS). This separates the presentation from the content and makes your html files up to 50% smaller. It is reported that the search engine bots prefer this and the more content you have compared to presentation in your file, the better you get rated.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;XHTML Standards:-&lt;/b&gt;Follow XHTML standards at the time of designing a site. Use &lt;a href=&quot;http://validator.w3.org/checklink&quot;&gt;W3C Link Checker&lt;/a&gt; to make sure all your page links are good. If you have broken links on your site this can effect the ranking you are given.&lt;br /&gt;
Put a proper doctype on each page. If you don&#39;t have a proper doctype on each page Internet Exployer will go into quirks mode and display it different.&lt;br /&gt;
Use &lt;a href=&quot;http://validator.w3.org/&quot;&gt;The W3C Markup Validate Service&lt;/a&gt; to verify that your pages are Validate HTML or XHTML code. The W3C validation will verify that your HTML or XHTML is not broken. This validation show you any broken code that could cause your webpages from displaying properly in all the different browsers and browser versions.&lt;/li&gt;
&lt;/ul&gt;&lt;b&gt;Now, let&#39;s talk about what you can do outside of your website to improve SERP rankings.&amp;nbsp; &lt;/b&gt;&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;&lt;b&gt;Backlinks:-&lt;/b&gt;You need to get as many backlinks as possible. However, you should pace yourself. Google knows the rate to which you get backlinks. If you increase this rate to fast, alarms go off and your website may get penalized. Plan on doing about 1 hour a day getting backlinks. Do not spend all day doing this.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Directories:-&lt;/b&gt;Submit your website to directories and lots of them including dmoz and yahoo directory.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;RSS feeds:-&lt;/b&gt;There are a lot ofRSS feed directories out there. If you got a RSS feed, submit it to these directories. This will increase traffic to your website.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Social Bookmarking:-&lt;/b&gt;Submit articles to websites such as digg.com and propeller. Submit videos to websites such as youtube and google. People will bookmark your articles and videos. This will drive traffic to your site. &lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Use press releases wisely:-&lt;/b&gt;Developing a relationship with media covering your industry or your local region can be a great source of exposure, including getting links from trusted media web sites. Distributing releases online can be an effective link building tactic, and opens the door for exposure in news search sites. &lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Start a blog and participate with other related blogs:-&lt;/b&gt;Search engines, Google especially, love blogs for the fresh content and highly-structured data. Beyond that, there’s no better way to join the conversations that are already taking place about your industry and/or company. Reading and commenting on other blogs can also increase your exposure and help you acquire new links. &lt;br /&gt;
&lt;i&gt;&lt;b&gt;Note:&lt;/b&gt;&lt;/i&gt; Put your blog at yourdomain.com/blog so your main domain gets the benefit of any links to your blog posts. If that’s not possible, use blog.yourdomain.com.&lt;br /&gt;
&lt;b&gt;&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Take advantage of local search opportunities&lt;/b&gt;&lt;b&gt;:-&lt;/b&gt;Online research for offline buying is a growing trend. Optimize your site to catch local traffic by showing your address and local phone number prominently. Write a detailed Directions/Location page using neighborhoods and landmarks in the page text. Submit your site to the free local listings services that the major search engines offer. Make sure your site is listed in local/social directories such as CitySearch, Yelp, Local.com, etc., and encourage customers to leave reviews of your business on these sites, too.&lt;/li&gt;
&lt;/ul&gt;I hope you enjoyed this article and it will help you a lot .I am happy if I get comments from this.</content><link rel='replies' type='application/atom+xml' href='http://sireeshnaidu.blogspot.com/feeds/7123048674575974189/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/1887130166514683270/7123048674575974189' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1887130166514683270/posts/default/7123048674575974189'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1887130166514683270/posts/default/7123048674575974189'/><link rel='alternate' type='text/html' href='http://sireeshnaidu.blogspot.com/2010/03/search-engine-optimizationseo.html' title='Search Engine Optimization(SEO) Techniques'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1887130166514683270.post-140612951156253367</id><published>2010-03-26T03:19:00.000-07:00</published><updated>2010-03-26T03:36:43.850-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="MySQL"/><title type='text'>Maintaining Database Tables</title><content type='html'>MySQL provides a bunch of statements to allow you to maintain database table more efficiently. Those statements enable you to analyze, optimize, check, and repair the database table. Here you will learn them all together with examples.&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;Analyze table statement&lt;/span&gt;&lt;br /&gt;
Basically analyze table statement allow you to update cardinality of an index column. By updating cardinality, you can retrieve the database faster by utilizing all index features of database tables.&lt;br /&gt;
You will work with the employees and offices table in our &lt;a href=&quot;http://www.mysqltutorial.org/data/sampledatabase.zip&quot;&gt;sample database&lt;/a&gt;. Let’s follow the example bellow to understand more how analyze table statement works.&lt;br /&gt;
We can get the indexes information from employees table by executing the show index statement as follows:&lt;br /&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;&lt;i&gt;&lt;b&gt;SHOW INDEX FROM employees;&lt;/b&gt;&lt;/i&gt;&lt;/div&gt;&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
MySQL gives you quite a lot of information about index in the employee table including cardinality; in this case the cardinality is 23.&lt;br /&gt;
Now we create a new index in the officeCode column to allow us to retrieve office and employee information by using join statement faster.&lt;br /&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;&lt;b&gt;&lt;i&gt;ALTER TABLE employees &lt;br /&gt;
ADD INDEX employee_offices (officeCode)&lt;/i&gt;&lt;/b&gt;;&lt;/div&gt;At this time the cardinality of the index is not updated, we can see this by performing the show index statement on employees table again.&lt;br /&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;&lt;b&gt;&lt;i&gt;SHOW INDEX FROM employees;&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;The cardinality now is NULL.&lt;br /&gt;
So the cardinality of index is not updated automatically when index created and a new record is inserted to the table. In this case, we can use analyze table statement to make an update on cardinality of the index column. By executing the following query:&lt;br /&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;&lt;b&gt;&lt;i&gt;ANALYZE TABLE employees;&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;And perform the show index statement on the table employees again you can see that the cardinality of indexed column employeeNumber and officeCode are updated.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;Optimize table statement&lt;/span&gt;&lt;br /&gt;
While working with the database, you do a lot of changes such as insert, update and delete data in the database tables therefore it causes the physical of database table fragmented. So the performance of database server is also degraded. MySQL provides you optimize table statement to allow you to optimize the database table to avoid this problem by defragmenting the table in physical level. The optimize table statement is as follows:&lt;br /&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;&lt;b&gt;&lt;i&gt;OPTIMIZE TABLE table_name;&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;With this optimize table statement, you should run it often with the tables which updated frequently.&lt;br /&gt;
Suppose you want to optimize the employees table to make it defragmented, you can perform the following query:&lt;br /&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;&lt;b&gt;&lt;i&gt;OPTIMIZE TABLE employees;&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;Here is the output:-&lt;br /&gt;
Table&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Op&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Msg_type&amp;nbsp; Msg_text&lt;br /&gt;
-----------------------&amp;nbsp; --------&amp;nbsp; --------&amp;nbsp; --------&lt;br /&gt;
classicmodels.employees&amp;nbsp; optimize&amp;nbsp; status&amp;nbsp;&amp;nbsp;&amp;nbsp; OK&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;Check table statement&lt;/span&gt;&lt;br /&gt;
Something wrong can happen to the database server such as server turn off unexpectedly, error while writing data to the hard disk and so on… all of these situations could make the database operate incorrectly and for the worst thing it can be crashed. MySQL supports you to check database table by using check table statement. Here is the syntax:&lt;br /&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;&lt;b&gt;&lt;i&gt;CHECK TABLE table_name;&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;The check table statements above check both table and correspondent indexes. For example, you can you check table statement to check the table employees as follows:&lt;br /&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;&lt;b&gt;&lt;i&gt;CHECK TABLE employees;&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;And here is the output&lt;br /&gt;
Table&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Op&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Msg_type&amp;nbsp; Msg_text&lt;br /&gt;
-----------------------&amp;nbsp; ------&amp;nbsp; --------&amp;nbsp; --------&lt;br /&gt;
classicmodels.employees&amp;nbsp; check&amp;nbsp;&amp;nbsp; status&amp;nbsp;&amp;nbsp;&amp;nbsp; OK&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
Check table statement only detect problems in a database table but it does not repair them. In order to do so you can you repair table statement.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;Repair table statement&lt;/span&gt;&lt;br /&gt;
Repair table statement allows you to repair some errors occurred in database tables. MySQL does not guarantee that this statement can repair all errors which your database may have. The repair table statement can be written as follows:&lt;br /&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;&lt;b&gt;&lt;i&gt;REPAIR TABLE table_name;&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;Suppose you have some errors in the employees table and need to fix, you can use repair table statement by performing this query:&lt;br /&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;&lt;b&gt;&lt;i&gt;REPAIR TABLE employees;&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;MySQL will return what it has done with the table and the table is repaired or not. Here is the output you always want to see in such cases:&lt;br /&gt;
Table&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Op&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Msg_type&amp;nbsp; Msg_text&lt;br /&gt;
-----------------------&amp;nbsp; ------&amp;nbsp; --------&amp;nbsp; --------&lt;br /&gt;
classicmodels.employees&amp;nbsp; repair&amp;nbsp; status&amp;nbsp;&amp;nbsp;&amp;nbsp; OK&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
Reference Link:-&lt;a href=&quot;http://www.mysqltutorial.org/mysql-database-table-maintenance-statements.aspx&quot; target=&quot;_blank&quot;&gt;http://www.mysqltutorial.org/mysql-database-table-maintenance-statements.aspx&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://sireeshnaidu.blogspot.com/feeds/140612951156253367/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/1887130166514683270/140612951156253367' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1887130166514683270/posts/default/140612951156253367'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1887130166514683270/posts/default/140612951156253367'/><link rel='alternate' type='text/html' href='http://sireeshnaidu.blogspot.com/2010/03/maintaining-database-tables.html' title='Maintaining Database Tables'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1887130166514683270.post-2571108338476100229</id><published>2010-03-26T02:49:00.000-07:00</published><updated>2010-03-26T02:54:04.527-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="MySQL"/><title type='text'>MySQL Storage Engines</title><content type='html'>MySQL supports various of table types or storage engines to allow you to optimize your database. The table types are available in MySQL are:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;ISAM&lt;/li&gt;
&lt;li&gt;MyISAM&lt;/li&gt;
&lt;li&gt;InnoDB&lt;/li&gt;
&lt;li&gt;BerkeleyDB (BDB)&lt;/li&gt;
&lt;li&gt;MERGE&lt;/li&gt;
&lt;li&gt;HEAP&lt;/li&gt;
&lt;/ul&gt;The most important feature to make all the table types above distinction is transaction-safe or not. Only InnoDB and BDB tables are transaction safe and only MyISAM tables support full-text indexing and searching feature. MyISAM is also the default table type when you create table without declaring which storage engine to use. Here are some major features of each table types:&lt;br /&gt;
&lt;b&gt;ISAM&lt;/b&gt;&lt;br /&gt;
ISAM had been deprecated and removed from version 5.x. All of it functionality entire replace by MyISAM. ISAM table has a hard size 4GB and is not portable.&lt;br /&gt;
&lt;b&gt;MyISAM &lt;/b&gt;&lt;br /&gt;
MyISAM table type is default when you create table. MyISAM table work very fast but not transaction-safe. The size of MyISAM table depends on the operating system and the data file are portable from system to system. With MyISAM table type, you can have 64 keys per table and maximum key length of 1024 bytes.&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;b&gt;InnoDB&lt;/b&gt;&lt;br /&gt;
Different from MyISAM table type, InnoDB table are transaction safe and supports row-level locking. Foreign keys are supported in InnoDB tables. The data file of InnoDB table can be stored in more than one file so the size of table depends on the disk space. Like the MyISAM table type, data file of InnoDB is portable from system to system. The disadvantage of InnoDB in comparison with MyISAM is it take more disk space. &lt;br /&gt;
&lt;b&gt;BDB&lt;/b&gt;&lt;br /&gt;
BDB is similar to InnoDB in transaction safe. It supports page level locking but data file are not portable. &lt;br /&gt;
&lt;b&gt;MERGE&lt;/b&gt;&lt;br /&gt;
Merge table type is added to treat multiple MyISAM tables as a single table so it remove the size limitation from MyISAM tables.&lt;br /&gt;
&lt;b&gt;HEAP&lt;/b&gt;&lt;br /&gt;
Heap table is stored in memory so it is the fastest one. Because of storage mechanism, the data will be lost when the power failure and sometime it can cause the server run out of memory. Heap tables do not support columns with AUTO_INCREMENT, BLOB and TEXT characteristics.&lt;br /&gt;
&lt;br /&gt;
Reference Link :- &lt;a href=&quot;http://www.mysqltutorial.org/understand-mysql-table-types-innodb-myisam.aspx&quot; target=&quot;_blank&quot;&gt;http://www.mysqltutorial.org/understand-mysql-table-types-innodb-myisam.aspx&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://sireeshnaidu.blogspot.com/feeds/2571108338476100229/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/1887130166514683270/2571108338476100229' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1887130166514683270/posts/default/2571108338476100229'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1887130166514683270/posts/default/2571108338476100229'/><link rel='alternate' type='text/html' href='http://sireeshnaidu.blogspot.com/2010/03/mysql-storage-engines.html' title='MySQL Storage Engines'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1887130166514683270.post-6603147873456923566</id><published>2010-03-23T00:28:00.000-07:00</published><updated>2010-03-23T00:55:45.280-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="PHP"/><title type='text'>PHP Performance Tuning By Configuring php.ini File</title><content type='html'>Follow the below settings for achieving better performace.&lt;br /&gt;
&lt;b&gt;register_globals = Off &lt;/b&gt;&lt;br /&gt;
Register_globals is fortunately since PHP 4.2.0 is disabled by default. If this setting to On, it is possible to all super global associative array of records ($ _POST, $ _GET, $ _REQUEST, $ _SESSION, $ _COOKIE, $ _SERVER, etc.) as a variable access. $ _SERVER [ &#39;PHP_SELF&#39;] then has the same content as $ PHP_SELF. And this is precisely what is a security risk if variables are not properly initialized. Therefore, these parameters are always off. If your own or third party scripts will no longer work, it is advisable to rewrite it rather than on register_globals to be on!&lt;br /&gt;
And quite incidentally eats memory, of course, to now back in the direction of performance-redirect, because every array entry must be an additional variable load.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;expose_php = Off&lt;/b&gt;&lt;br /&gt;
This setting adds - if they are to On - any HTTP response header entry, that the page was created with PHP. This is unnecessary, because your users are not interested anyway. Interesting but very probably hackers, because the more the infrastructure on the one side, the easier it gets. And out of sight performance, the added header entry of course be transferred to the client. So better off to make.&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;b&gt;register_argc_argv = Off&lt;/b&gt;This setting is only useful if you PHP from the command calls and wants mitgeben parameters (as in C, these happen to be in argv and the number of parameters in argc). Who does not do so, you can safely disable register_argc_argv since then less memory is occupied.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;always_populate_raw_post_data = Off&lt;/b&gt;&lt;br /&gt;
If this setting is enabled, then $ HTTP_RAW_POST_DATA filled. I&#39;ve never needed. But you should look at the foreign scripts eigesetzten see if the use of this variable. Wordpress does this, for example, but is so smart (because it was on as many server configurations to run), not to leave, because if always_populate_raw_post_data Off is on, you can still input stream and then retrieve the same data:&lt;br /&gt;
&lt;i&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ( ! isset ( $HTTP_RAW_POST_DATA ) ) {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $HTTP_RAW_POST_DATA = file_get_contents ( ‘php://input’ ) ;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/i&gt;&lt;br /&gt;
It was briefly mentioned here, just like us to work with PHP Streams makes, because you can simply treat such files - great if you compare times with Java ...&lt;br /&gt;
In consequence always_populate_raw_post_data can always be turned off and let the above snippet to be built. Otherwise, pull the server at times, etc. and suddenly nothing is more. Is also an additional security.&lt;br /&gt;
&lt;br /&gt;
Please make these settings but not simply and well, but after switching to test your project and enabled the best and the PHP error log and provide error reporting to E_ALL, so that you can see, if something goes wrong. Optimal would be of course a separate development server - at any rate, it is not recommended, without testing the settings. If someone other tricks in php.ini (in terms of performance or security) knows, I would be happy about comments.</content><link rel='replies' type='application/atom+xml' href='http://sireeshnaidu.blogspot.com/feeds/6603147873456923566/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/1887130166514683270/6603147873456923566' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1887130166514683270/posts/default/6603147873456923566'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1887130166514683270/posts/default/6603147873456923566'/><link rel='alternate' type='text/html' href='http://sireeshnaidu.blogspot.com/2010/03/php-performance-tuning-by-configuring.html' title='PHP Performance Tuning By Configuring php.ini File'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1887130166514683270.post-800531582927473117</id><published>2010-03-22T23:41:00.000-07:00</published><updated>2010-03-23T00:53:54.795-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Ubuntu"/><title type='text'>Installing &amp; Uninstalling an RPM Package on Ubuntu</title><content type='html'>Installing software on Ubuntu usually entails using Synaptic or by using an apt-get install command from the terminal. Unfortunately, there are still a number of packages out there that are only distributed in RPM format.&lt;br /&gt;
There&#39;s a utility called Alien that converts packages from one format to the other.This doesn&#39;t always mean that an rpm will work on your system, though. You will need to install some prerequisite software packages in order to install alien, however. These packages include gcc and make.&lt;br /&gt;
Run the below command to install alien and other necessary packages&lt;br /&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-style: italic; font-weight: bold;&quot;&gt;sudo apt-get install alien dpkg-dev debhelper build-essential&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;
To convert a package from rpm to debian format,Run the below command&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-style: italic; font-weight: bold;&quot;&gt;sudo alien packagename.rpm &lt;/span&gt;&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;To install the package, you&#39;ll use the dpkg utility, which is the internal package management tool behind debian and Ubuntu.&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-style: italic; font-weight: bold;&quot;&gt;sudo dpkg -i packagename.deb&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;The package should now be installed, providing it&#39;s compatible with your system.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;Uninstall Package&lt;br /&gt;
&lt;/span&gt;To uninstall the .deb package&lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-style: italic; font-weight: bold;&quot;&gt;sudo dpkg -r packagename.deb &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sireeshnaidu.blogspot.com/feeds/800531582927473117/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/1887130166514683270/800531582927473117' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1887130166514683270/posts/default/800531582927473117'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1887130166514683270/posts/default/800531582927473117'/><link rel='alternate' type='text/html' href='http://sireeshnaidu.blogspot.com/2010/03/installing-rpm-package-on-ubuntu.html' title='Installing &amp; Uninstalling an RPM Package on Ubuntu'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>