<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.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"><id>tag:blogger.com,1999:blog-8191367375415289842</id><updated>2009-11-10T21:42:28.992-08:00</updated><title type="text">WEBNOLOGY ::  Web Development Technologies</title><subtitle type="html">Find out the Web, the spiders and the technology used to create the web. Web development technologies PHP,ASP.NET,Javascript,Ajax,JSON,Python,CSS,HTML,DHTML,XML,tips and tricks, technology articles.</subtitle><link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://webnology.blogspot.com/feeds/posts/default" /><link rel="alternate" type="text/html" href="http://webnology.blogspot.com/" /><link rel="hub" href="http://pubsubhubbub.appspot.com/" /><link rel="next" type="application/atom+xml" href="http://www.blogger.com/feeds/8191367375415289842/posts/default?start-index=26&amp;max-results=25" /><author><name>unni</name><uri>http://www.blogger.com/profile/07413941466960411392</uri><email>noreply@blogger.com</email></author><generator version="7.00" uri="http://www.blogger.com">Blogger</generator><openSearch:totalResults>85</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><link rel="self" href="http://feeds.feedburner.com/WebnologyWebDevelopmentTechnologies" type="application/atom+xml" /><feedburner:emailServiceId xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">WebnologyWebDevelopmentTechnologies</feedburner:emailServiceId><feedburner:feedburnerHostname xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">http://feedburner.google.com</feedburner:feedburnerHostname><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><entry><id>tag:blogger.com,1999:blog-8191367375415289842.post-2802843703237455591</id><published>2008-11-08T11:39:00.001-08:00</published><updated>2008-11-08T11:39:45.420-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="php" /><title type="text">register_shutdown_function possible use cases</title><content type="html">Eirik Hoem on his blog provides an overview of PHP’s register_shutdown_function, and suggests using it for the cases when for whatever reason your Web page ran out of memory, fatal’ed, and you don’t want to display a blank page to the users.&lt;span class="fullpost"&gt;&lt;br /&gt;&lt;br /&gt;register_shutdown_function is also useful for command-line scripts with PHP. Pretty frequently your script has to do some task like parse a large XML file, and the test examples when it was originally written did not account for the XML file possible being huge. Therefore your script dies with like 23% completion, and you’re left with 23% of the XML file parsed. Not ideal, but a quick duct-tape-style fix, would be to introduce a register_shutdown_function call to system(), to which you pass the script itself.&lt;br /&gt;&lt;br /&gt;If you happen to keep track of which line you’re on while parsing, you can pass the line number as the first parameter to your own script, and make it start off after that 23% mark, or wherever it died. The script then needs to be launched with 0 passed as the first parameter. It will run out of memory, die, launch register_shutdown_function, which will launch another copy of the script (while successfully shutting down the original process) with a new line number, which will repeat the process.&lt;br /&gt;&lt;br /&gt;Again, this is a duct tape approach to PHP memory consumption issues while working with large data sets.&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8191367375415289842-2802843703237455591?l=webnology.blogspot.com'/&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://webnology.blogspot.com/feeds/2802843703237455591/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=8191367375415289842&amp;postID=2802843703237455591" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8191367375415289842/posts/default/2802843703237455591" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8191367375415289842/posts/default/2802843703237455591" /><link rel="alternate" type="text/html" href="http://webnology.blogspot.com/2008/11/registershutdownfunction-possible-use.html" title="register_shutdown_function possible use cases" /><author><name>unni</name><uri>http://www.blogger.com/profile/07413941466960411392</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd="http://schemas.google.com/g/2005" name="OpenSocialUserId" value="18119052226690880461" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8191367375415289842.post-7063379015281888493</id><published>2008-11-08T11:25:00.000-08:00</published><updated>2008-11-08T11:37:00.680-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Web Tips" /><category scheme="http://www.blogger.com/atom/ns#" term="php" /><title type="text">24 Web site performance tips</title><content type="html">Yahoo! Developer Network blog had an entry by Stoyan Stefanov and presentation from PHP Quebec conference. A few points to take away, in case you don’t feel like going through 76-slide presentation:&lt;br /&gt;&lt;span class="fullpost"&gt;&lt;br /&gt;  1. A drop of 100ms in page rendering time leads to 10% in sales on Amazon. A drop of 500 ms leads to 20% less traffic to Google.&lt;br /&gt;  2. Make fewer HTTP requests - combine CSS and JS files into single downloads. Minify both JS and CSS.&lt;br /&gt;  3. Combine images into CSS sprites.&lt;br /&gt;  4. Bring static content closer to the users. That usually means CDNs like Akamai or Limelight, but sometimes a co-location facility or data center in a foreign country is the only option.&lt;br /&gt;  5. Static content should have Expires: headers way into the future, so that they’re never re-requested.&lt;br /&gt;  6. Dynamic content should have Cache Control: header.&lt;br /&gt;  7. Offer content gzip’ed.&lt;br /&gt;  8. Stoyan claims nothing will be rendered in the browser till the last piece of CSS has been served, and therefore it’s critical to send CSS as early in the process as possible. I happen to have a document with CSS declared at the very end, and disagree with this statement - at least the content seems to render OK without CSS, and then self-corrects when CSS finally loads.&lt;br /&gt;  9. Move the scripts all the way to the bottom to avoid the download block - Stoyan’s example shows placing the javascript includes right before and , although it’s possible to place them even further down (well, you’d break XHTML purity, I suppose, if you declare your documents to be XHTML).&lt;br /&gt; 10. Avoid CSS expressions.&lt;br /&gt; 11. Consider placing the minified CSS and JS files on separate servers to fight browser’s default pipelining settings - not everybody has FasterFox or tweaked pipeline settings.&lt;br /&gt; 12. For super-popular pages consider inlining JS for fewer HTTP requests.&lt;br /&gt; 13. Even though placing content on external servers with different domains will help you with HTTP pipelining, don’t go crazy with various domains - they all require DNS lookups.&lt;br /&gt; 14. Every 301 redirect is a wasted HTTP request.&lt;br /&gt; 15. For busy backend servers consider PHP’s flush().&lt;br /&gt; 16. Use GET over POST any time you have a choice.&lt;br /&gt; 17. Analyze your cookies - large number of them could substantially increase the number of TCP packets.&lt;br /&gt; 18. For faster JavaScript and DOM parsing, reduce the number of DOM elements.&lt;br /&gt; 19. document.getElementByTagName(’*').length will give you the number of total elements. Look at those abusive &lt;div&gt;s.&lt;br /&gt; 20. Any missing JS file is a significant performance penalty - the browser will browse the 404 page you generate, trying to see if it has valid &lt;script&gt;s.&lt;br /&gt;  21. Optimize your PNGs - check out pngcrush, pngoptimizer&lt;br /&gt;  22. Optimize JPEGs - jpegtran&lt;br /&gt;  23. Make sure you have favicon.ico - generating those 404s will be expensive, plus once you have it, it’s cache-able.&lt;br /&gt;  24. Toolkits for measuring page loads: AOL PageTest, FiddlerTool HTTP debugging proxy, IBM Page Detailer instrumentation tool, YSlow, and Firebug are suggested in the presentation. My personal addition to the list is Charles that has been recommended by a colleague.&lt;/span&gt;&lt;/script&gt;&lt;/div&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8191367375415289842-7063379015281888493?l=webnology.blogspot.com'/&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://webnology.blogspot.com/feeds/7063379015281888493/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=8191367375415289842&amp;postID=7063379015281888493" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8191367375415289842/posts/default/7063379015281888493" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8191367375415289842/posts/default/7063379015281888493" /><link rel="alternate" type="text/html" href="http://webnology.blogspot.com/2008/11/24-web-site-performance-tips.html" title="24 Web site performance tips" /><author><name>unni</name><uri>http://www.blogger.com/profile/07413941466960411392</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd="http://schemas.google.com/g/2005" name="OpenSocialUserId" value="18119052226690880461" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8191367375415289842.post-994530983396118894</id><published>2008-11-08T11:05:00.000-08:00</published><updated>2008-11-08T11:23:38.216-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="php" /><category scheme="http://www.blogger.com/atom/ns#" term="FirePhp" /><title type="text">FirePHP for PHP and AJAX development</title><content type="html">FirePHP is a package consisting of a Firefox extension and server-side PHP library for quick PHP development on top of Firebug. It allows you to include the PHP library, and issue logging calls like&lt;br /&gt;&lt;br /&gt;&lt;span class="fullpost"&gt;&lt;br /&gt;fb('Log message'  ,FirePHP::LOG);&lt;br /&gt;   fb(’Info message’ ,FirePHP::INFO);&lt;br /&gt;   fb(’Warn message’ ,FirePHP::WARN);&lt;br /&gt;   fb(’Error message’,FirePHP::ERROR);&lt;br /&gt;&lt;br /&gt;This is visible only to the Firefox version that has FirePHP installed on top of Firebug. You can also dump entire array and objects to the fb() function call, and have them displayed in Firebug UI.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_VHplZu23whg/SRXm9Cn4dKI/AAAAAAAAH0Y/cKjPnkL9NyU/s1600-h/image-thumb.png"&gt;&lt;img style="cursor: pointer; width: 296px; height: 320px;" src="http://4.bp.blogspot.com/_VHplZu23whg/SRXm9Cn4dKI/AAAAAAAAH0Y/cKjPnkL9NyU/s320/image-thumb.png" alt="" id="BLOGGER_PHOTO_ID_5266369275630220450" border="0" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8191367375415289842-994530983396118894?l=webnology.blogspot.com'/&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://webnology.blogspot.com/feeds/994530983396118894/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=8191367375415289842&amp;postID=994530983396118894" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8191367375415289842/posts/default/994530983396118894" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8191367375415289842/posts/default/994530983396118894" /><link rel="alternate" type="text/html" href="http://webnology.blogspot.com/2008/11/firephp-for-php-and-ajax-development.html" title="FirePHP for PHP and AJAX development" /><author><name>unni</name><uri>http://www.blogger.com/profile/07413941466960411392</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd="http://schemas.google.com/g/2005" name="OpenSocialUserId" value="18119052226690880461" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/_VHplZu23whg/SRXm9Cn4dKI/AAAAAAAAH0Y/cKjPnkL9NyU/s72-c/image-thumb.png" height="72" width="72" /><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8191367375415289842.post-7776819750147580310</id><published>2008-11-08T11:00:00.000-08:00</published><updated>2008-11-08T11:03:53.410-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="zend" /><category scheme="http://www.blogger.com/atom/ns#" term="php" /><title type="text">PHP Top scalability mistakes</title><content type="html">1. Define the scalability goals for your application. If you don’t know how many requests you’re shooting for, you don’t know whether you’ve built something that works, and how long it’s going to last you.&lt;br /&gt;   2. Measure everything. CPU usage, memory usage, disk I/O, network I/O, requests per second, with the last one being the most important. If you don’t know the baseline, you don’t know whether you’ve improved.&lt;br /&gt;   3. Design your database with scalability in mind. Assume you’ll have to implement replication.&lt;br /&gt;&lt;span class="fullpost"&gt;John Coggeshall, CTO of Automotive Computer Services, and author of Zend PHP Certification Practice Book and PHP5 Unleashed, gave a talk at OSCON 2008 on top 10 scalability mistakes. I wasn’t there, but he posted the slides for everybody to follow. Here’re some lessons learned.&lt;br /&gt;&lt;br /&gt;   1. Define the scalability goals for your application. If you don’t know how many requests you’re shooting for, you don’t know whether you’ve built something that works, and how long it’s going to last you.&lt;br /&gt;   2. Measure everything. CPU usage, memory usage, disk I/O, network I/O, requests per second, with the last one being the most important. If you don’t know the baseline, you don’t know whether you’ve improved.&lt;br /&gt;   3. Design your database with scalability in mind. Assume you’ll have to implement replication.&lt;br /&gt;   4. Do not rely on NFS for code sharing on a server farm. It’s slow and it’s got locking issues. While the idea of keeping one copy of code, and letting the rest of the servers load them via NFS might seem very convenient, it doesn’t work in practice. Stick to some tried practices like rsync. Keep the code local to the machine serving it, even if it means a longer push process.&lt;br /&gt;   5. Play around with I/O buffers. If you’ve got tons of memory, play with TCP buffer size - your defaults are likely to be set conservatively. See your tax dollars at work and use this Linux TCP Tuning guide. If your site is written in PHP, use output buffering functions.&lt;br /&gt;   6. Use Ram Disks for any data that’s disposable. But you do need a lot of available RAM lying around.&lt;br /&gt;   7. Optimize bandwidth consumption by enabling compression via mod_deflate, setting zlib.put_compression value to true for PHP sites, or Tidy content reduction for PHP+Tidy sites.&lt;br /&gt;   8. Confugure PHP for speed. Turn off the following: register_globals, auto_globals_jit, magic_quotes_gpc, expose_php, register_argc_argv, always_populate_raw_post_data, session.use_trans_sid, session.auto_start. Set session.gc_divisor to 10,000, output_buffering to 4096, in John’s example.&lt;br /&gt;   9. Do not use blocking I/O, such as reading another remote page via curl. Make all the calls non-blocking, otherwise the wait is something you can’t really optimize against. Rely on background scripts to pull down the data necessary for processing the request.&lt;br /&gt;  10. Don’t underestimate caching. If a page is cached for 5 minutes, and you get even 10 requests per second for a given page, that’s 3,000 requests your database doesn’t have to process.&lt;br /&gt;  11. Consider PHP op-code cache. This will be available to you off-the-shelf with PHP6.&lt;br /&gt;  12. For content sites consider taking static stuff out of dynamic context. Let’s say you run a content site, where the article content remains the same, while the rest of the page is personalized for each user, as it has My Articles section, and so on. Instead of getting everything dynamically from the DB, consider generating yet another PHP file on the first request, where the article text would be stored in raw HTML, and dynamic data pulled for logged-in users. This way the generated PHP file will only pull out the data that’s actually dynamic.&lt;br /&gt;  13. Pay great attention to database design. Learn indexes and know how to use them properly. InnoDB outperforms MyISAM in almost all contexts, but doesn’t do full-text searching. (Use sphinx if your search needs get out of control.)&lt;br /&gt;  14. Design PHP applications in an abstract way, so that the app never needs to know the IP address of the MySQL server. Something like ‘mysql-writer-db’, and ‘mysql-reader-db’ will be perfectly ok for a PHP app.&lt;br /&gt;  15. Run external scripts monitoring the system health. Have the scripts change the HOSTS if things get out of control.&lt;br /&gt;  16. Do not do database connectivity decision-making in PHP. Don’t spend time doing fallbacks if your primary DB is down. Consider running MySQL Proxy for simplifying DB connectivity issues.&lt;br /&gt;  17. For super-fast reads consider SQLite.  But don’t forget that it’s horrible with writes.&lt;br /&gt;  18. Use Keepalive properly. Use it when both static and dynamic files are served off the same server, and you can control the timeouts, so that a bunch of Keep-alive requests don’t overwhelm your system. John’s rule? No Keep-alive request should last more than 10 seconds.&lt;br /&gt;  19. Monitor via familiar Linux commands. Such as iostat and vmstat. The iostat command is used for monitoring system input/output device loading by observing the time the devices are active in relation to their average transfer rates. The iostat command generates reports that can be used to change system configuration to better balance the input/output load between physical disks. vmstat  reports  information about processes, memory, paging, block IO, traps, and cpu activity.&lt;br /&gt;  20. Make sure you’re logging relevant information right away. Otherwise debugging issues is going to get tricky.&lt;br /&gt;  21. Prioritize your optimizations. Optimization by 50% of the code that runs on 2% of the pages will result in 1% total improvement. Optimizing 10% of the code that runs on 80% of the pages results in 8% overall improvement.&lt;br /&gt;  22. Use profilers. They draw pretty graphs, they’re generally easy to use.&lt;br /&gt;  23. Keep track of your system performance. Keep a spreadsheet of some common stats you’re tracking, so that you can authoritatively say how much of performance gain you got by getting a faster CPU, installing extra RAM, or upgrading your Linux kernel.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8191367375415289842-7776819750147580310?l=webnology.blogspot.com'/&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://webnology.blogspot.com/feeds/7776819750147580310/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=8191367375415289842&amp;postID=7776819750147580310" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8191367375415289842/posts/default/7776819750147580310" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8191367375415289842/posts/default/7776819750147580310" /><link rel="alternate" type="text/html" href="http://webnology.blogspot.com/2008/11/top-scalability-mistakes.html" title="PHP Top scalability mistakes" /><author><name>unni</name><uri>http://www.blogger.com/profile/07413941466960411392</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd="http://schemas.google.com/g/2005" name="OpenSocialUserId" value="18119052226690880461" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8191367375415289842.post-1536894429988399748</id><published>2008-11-08T10:58:00.000-08:00</published><updated>2008-11-08T11:00:10.107-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="sql" /><category scheme="http://www.blogger.com/atom/ns#" term="php" /><title type="text">Sphinx search ported to PECL</title><content type="html">Anthony Dovgal reported on adding open source SQL full-text search engine sphinx to PECL. The documentation is available on the PHP site, the engine is available upon including sphinxapi.php in your application. &lt;br /&gt;&lt;br /&gt;&lt;span class="fullpost"&gt;You know the usual InnoDB vs. the MyISAM trade-offs, where the former is faster, but the latter has the full-text search? Sphinx is a free open-source full-text search engine that works with many RDMBS, and now is pretty easy to incorporate into PHP. A simple example of calling Sphinx is available here:&lt;br /&gt;&lt;br /&gt;    $s = new SphinxClient;&lt;br /&gt;    $s-&gt;setServer("localhost", 6712);&lt;br /&gt;    $s-&gt;setMatchMode(SPH_MATCH_ANY);&lt;br /&gt;    $s-&gt;setMaxQueryTime(3);&lt;br /&gt;    $result = $s-&gt;query("test");&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8191367375415289842-1536894429988399748?l=webnology.blogspot.com'/&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://webnology.blogspot.com/feeds/1536894429988399748/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=8191367375415289842&amp;postID=1536894429988399748" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8191367375415289842/posts/default/1536894429988399748" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8191367375415289842/posts/default/1536894429988399748" /><link rel="alternate" type="text/html" href="http://webnology.blogspot.com/2008/11/sphinx-search-ported-to-pecl.html" title="Sphinx search ported to PECL" /><author><name>unni</name><uri>http://www.blogger.com/profile/07413941466960411392</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd="http://schemas.google.com/g/2005" name="OpenSocialUserId" value="18119052226690880461" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8191367375415289842.post-1837433271322064332</id><published>2008-11-08T10:49:00.000-08:00</published><updated>2008-11-08T10:51:10.947-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="php" /><title type="text">Best practices in PHP development</title><content type="html">1. Use source control&lt;br /&gt;         1. First, choose between distributed and non-distributed&lt;br /&gt;         2. Then, if you chose non-distributed, choose between CVS and SVN&lt;br /&gt;         3. In Subversion, use trunk/ for ongoing development and bug fixes, branches/ for ongoing large projects that later need to be merged in, and tags/ for releases&lt;br /&gt;         4. Use svn externals to connect to remote repositories&lt;br /&gt;         5. Subversion supports pre-commit and post-commit hooks for better code maintainability and checks&lt;br /&gt;&lt;br /&gt;&lt;span class="fullpost"&gt;   &lt;br /&gt;&lt;br /&gt;   2. Implement coding standards&lt;br /&gt;         1. Develop class, variable, function, package, etc. naming conventions&lt;br /&gt;         2. Agree on common formatting as far as spacing, braces, etc.&lt;br /&gt;         3. Implement comment standards&lt;br /&gt;         4. PHP_CodeSniffer can run on pre-commit to check whether the commit adheres to the standards&lt;br /&gt;         5. Don’t forget to enforce coding standards on any outsourced projects&lt;br /&gt;   3. Unit testing and code coverage&lt;br /&gt;         1. Use PHPUnit for unit testing&lt;br /&gt;         2. For continuous integration, check out phpUnderControl&lt;br /&gt;         3. For integration testing, check out Selenium, a general Web application testing suite&lt;br /&gt;   4. Documentation&lt;br /&gt;         1. Don’t invent your own standards, see what phpDocumentor has to offer. Doxygen also supports phpDoc tags&lt;br /&gt;         2. For documenting the software project, try DocBook - XML-based format that allows you to quickly publish a PDF document, or a Website with documentation&lt;br /&gt;   5. Deployment&lt;br /&gt;         1. Have a standard deployment process that a rookie can familiarize with quickly&lt;br /&gt;         2. Support 3 environments - development, staging, and production&lt;br /&gt;         3. Deploy code only from repository tags, don’t run trunk, or allow code editing on server&lt;br /&gt;         4. Check out a new tag from SVN, point the symlink to it. If something goes wrong during release, change the symlink back to the previous version - easy rollback strategy&lt;br /&gt;         5. Everything that needs to be done on the production servers needs to be automated&lt;br /&gt;         6. You can do another Selenium test after the release is deployed&lt;br /&gt;         7. Check out Monit and Supervisord for deployment monitoring&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8191367375415289842-1837433271322064332?l=webnology.blogspot.com'/&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://webnology.blogspot.com/feeds/1837433271322064332/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=8191367375415289842&amp;postID=1837433271322064332" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8191367375415289842/posts/default/1837433271322064332" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8191367375415289842/posts/default/1837433271322064332" /><link rel="alternate" type="text/html" href="http://webnology.blogspot.com/2008/11/best-practices-in-php-development.html" title="Best practices in PHP development" /><author><name>unni</name><uri>http://www.blogger.com/profile/07413941466960411392</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd="http://schemas.google.com/g/2005" name="OpenSocialUserId" value="18119052226690880461" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8191367375415289842.post-6060182486138604833</id><published>2008-11-08T10:30:00.000-08:00</published><updated>2008-11-08T10:47:25.156-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="php" /><title type="text">12 PHP optimization tips</title><content type="html">1. If a method can be static, declare it static. Speed improvement is by a factor of 4.&lt;br /&gt;   2. Avoid magic like __get, __set, __autoload&lt;br /&gt;   3. require_once() is expensive&lt;br /&gt;   4. Use full paths in includes and requires, less time spent on resolving the OS paths.&lt;br /&gt;   5. If you need to find out the time when the script started executing, $_SERVER['REQUEST_TIME'] is preferred to time()&lt;br /&gt;   &lt;br /&gt;&lt;span class="fullpost"&gt;6. See if you can use strncasecmp, strpbrk and stripos instead of regex&lt;br /&gt;   7. str_replace is faster than preg_replace, but strtr is faster than str_replace by a factor of 4&lt;br /&gt;   8. 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;   9. Error suppression with @ is very slow.&lt;br /&gt;  10. $row['id'] is 7 times faster than $row[id]&lt;br /&gt;  11. Error messages are expensive&lt;br /&gt;  12. Do not use functions inside of for loop, such as for ($x=0; $x &lt; count($array); $x) The count() function gets called each time.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8191367375415289842-6060182486138604833?l=webnology.blogspot.com'/&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://webnology.blogspot.com/feeds/6060182486138604833/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=8191367375415289842&amp;postID=6060182486138604833" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8191367375415289842/posts/default/6060182486138604833" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8191367375415289842/posts/default/6060182486138604833" /><link rel="alternate" type="text/html" href="http://webnology.blogspot.com/2008/11/12-php-optimization-tips.html" title="12 PHP optimization tips" /><author><name>unni</name><uri>http://www.blogger.com/profile/07413941466960411392</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd="http://schemas.google.com/g/2005" name="OpenSocialUserId" value="18119052226690880461" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8191367375415289842.post-2823005807765689404</id><published>2008-11-08T00:00:00.000-08:00</published><updated>2008-11-08T00:12:24.790-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="html" /><title type="text">Online Forms? Get Vizzual!</title><content type="html">VizzualForms is a Web-based data management system created for collecting, storing and processing data via the Internet. It allows you to create and publish Web forms in mere minutes without any programming knowledge or advanced computer skills.&lt;br /&gt;It is a time- and cost-effective solution for private or business use. It is very easy to use, yet it is powerful. It includes a visual form creator, data processing tool, contact manager, invitation module and report tool.&lt;br /&gt;&lt;br /&gt;&lt;span class="fullpost"&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Company Name&lt;/span&gt;&lt;br /&gt;Vizzual&lt;/span&gt;&lt;div style="text-align: right;"&gt;&lt;img src="http://2.bp.blogspot.com/_VHplZu23whg/SRVJlrS0vVI/AAAAAAAAHn8/hfsiaiKO_vg/s200/vizzual-logo.jpg" style="cursor:pointer; cursor:hand;width: 200px; height: 70px;" border="0" alt="" id="BLOGGER_PHOTO_ID_5266196250905328978" /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="fullpost"&gt;&lt;span style="font-weight:bold;"&gt;20-Word Description&lt;/span&gt;&lt;br /&gt;The idea of VizzualForms is to allow users to create even the most complicated forms in a simple manner. It is about collecting, storing and processing data.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;CEO’s Pitch&lt;/span&gt;&lt;br /&gt;VizzualForms is a Web-based data management system created for collecting, storing and processing data via the Internet. It allows you to create and publish Web forms in mere minutes without any programming knowledge or advanced computer skills.&lt;br /&gt;It is a time- and cost-effective solution for private or business use. It is very easy to use, yet it is powerful. It includes a visual form creator, data processing tool, contact manager, invitation module and report tool.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="fullpost"&gt;&lt;br /&gt;With VizzualForms users can create a broad spectrum of forms, invite others to fill in the forms and see or share the results in real time. Our integrated email notification system can send email with data to a mailbox each time a form is submitted, guaranteeing that no request or data will be missed. Forms created with VizzualForms can be embedded into Web page or delivered using an invitation module.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Mashable’s Take&lt;/span&gt;&lt;br /&gt;There are a number of applications and services, online and off, that will accomplish the task of producing forms for numerous purposes. Tools featured within the near-ubiquitous Microsoft Office can manage things like surveys and registration forms and whatnot. The same with Apple’s iWork suite and other similar releases. Meanwhile, Web-based options like FormSite, ExtremeForm, JotForm, and Wufoo can accomplish needed designs with varying degrees of customization and interactivity.&lt;br /&gt;Vizzual Forms is one such character. Users of Vizzual Forms are served with what basically amount to two utilities. One intended for form assembly, the other for data analysis. The first is fairly intuitive to operate. It generally works the way the average user might expect it to. Its strongest features are for editing. Sending things to a user’s contact list might be a little tedious at first, but so long as you maintain an account with regularity, you’ll learn the proverbial ropes pretty quickly, we think. Besides, if you’re conducting an online poll or making some other request, embeds can be easily made.&lt;br /&gt;&lt;br /&gt;Depending on your level of engagement, you can make do with a cost-free and ad-supported account, or spring for a Basic ($8.50), Small Biz ($16.50), or Enterprise-level registration ($31.50). Companies looking to host Vizzual on their own servers can even pony up $1,900 for the privilege.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="fullpost"&gt;&lt;br /&gt;To be honest, what Vizzual Forms will help you produce won’t be aesthetically brilliant by any means. The examples it reveals are pretty ordinary. Apart from a palette of colors, you might say things are a bit boring. But rarely is the act of filling a form with information a truly fun endeavor. So the important thing, then, is for the service to help Joe Creator ease through the process as best he or she can. And Vizzual Forms appears conditioned to do just that. You can certainly be specific with an editing job if you like. Nothing really stops you from spending a great deal of time fine-tuning a poll or whathaveyou. But you’ll rarely, if ever, be lost for a visual guide on how to get it done.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8191367375415289842-2823005807765689404?l=webnology.blogspot.com'/&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://webnology.blogspot.com/feeds/2823005807765689404/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=8191367375415289842&amp;postID=2823005807765689404" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8191367375415289842/posts/default/2823005807765689404" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8191367375415289842/posts/default/2823005807765689404" /><link rel="alternate" type="text/html" href="http://webnology.blogspot.com/2008/11/online-forms-get-vizzual.html" title="Online Forms? Get Vizzual!" /><author><name>unni</name><uri>http://www.blogger.com/profile/07413941466960411392</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd="http://schemas.google.com/g/2005" name="OpenSocialUserId" value="18119052226690880461" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/_VHplZu23whg/SRVJlrS0vVI/AAAAAAAAHn8/hfsiaiKO_vg/s72-c/vizzual-logo.jpg" height="72" width="72" /><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8191367375415289842.post-5516331666336932316</id><published>2008-11-03T05:44:00.000-08:00</published><updated>2008-11-03T05:48:57.352-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="SEO" /><category scheme="http://www.blogger.com/atom/ns#" term="Search Engine" /><category scheme="http://www.blogger.com/atom/ns#" term="Web Crawlers" /><category scheme="http://www.blogger.com/atom/ns#" term="Robots" /><title type="text">Understanding a Robots.txt File</title><content type="html">The robots.txt file allows you to control the behavour of web crawlers and spiders that visit your site. Most web crawlers are harmless and simply collect data for various reasons like search engine listings, internet archiving, validating links, security scanning, etc. It's always a good idea to create a robots.txt to tell the crawlers where they can go and where they can not. &lt;br /&gt;&lt;span class="fullpost"&gt;A crawler should always follow the "The Robots Exclusion Protocol" and therefore whever it comes to a web site to crawl it, it first checks the robots.txt file. &lt;blockquote&gt;&lt;br /&gt;www.yourdomain.com/robots.txt&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Once it has processed the robots.txt file it will then proceed to the rest of your site usually starting at the index file and traversing throughout. There are quite often places on a web site which do not need to be crawled, like the images directory, data directories, etc so these are what you need to place into your robots file.&lt;br /&gt;&lt;br /&gt;The "/robots.txt" file is simply a text file, which contains one or more records. A single record looking like this: &lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;User-agent: *&lt;br /&gt;Disallow: /&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;The "User-agent: *" means this section applies to all robots. The "Disallow: /" tells the robot that it should not visit any pages on the web site.&lt;br /&gt;&lt;br /&gt;A basic tobots.txt example &lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;User-agent: *&lt;br /&gt;Disallow: /cgi-bin/&lt;br /&gt;Disallow: /tmp/&lt;br /&gt;Disallow: /junk/&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Allowing a single crawler &lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;User-agent: Google&lt;br /&gt;Disallow:&lt;br /&gt;&lt;br /&gt;User-agent: *&lt;br /&gt;Disallow: /&lt;br /&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;To exclude a single robot &lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;User-agent: BadBot&lt;br /&gt;Disallow: /&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8191367375415289842-5516331666336932316?l=webnology.blogspot.com'/&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://webnology.blogspot.com/feeds/5516331666336932316/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=8191367375415289842&amp;postID=5516331666336932316" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8191367375415289842/posts/default/5516331666336932316" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8191367375415289842/posts/default/5516331666336932316" /><link rel="alternate" type="text/html" href="http://webnology.blogspot.com/2008/11/understanding-robotstxt-file.html" title="Understanding a Robots.txt File" /><author><name>unni</name><uri>http://www.blogger.com/profile/07413941466960411392</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd="http://schemas.google.com/g/2005" name="OpenSocialUserId" value="18119052226690880461" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8191367375415289842.post-7674440419866158270</id><published>2008-11-03T05:32:00.000-08:00</published><updated>2008-11-03T05:36:29.636-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Technology News" /><title type="text">People-search sites Reunion.com, Wink to merge</title><content type="html">Social network Reunion.com has made a new friend: people search service Wink. The two have merged in a new deal that promises to make it dramatically easier to find people on the Web.&lt;span class="fullpost"&gt;Early next year, the merger will produce "an entirely new brand," the companies said. The two have not said what its name will be, nor have financial details been disclosed. With the dual technologies of Reunion and Wink, the companies say that they will be able to search more than 700 million social-networking profiles. They'll be able to search profiles on MySpace, Facebook, LinkedIn, Friendster, AOL's Bebo, Microsoft's Windows Live Spaces, Yahoo, Xanga, and Twitter--among others.&lt;br /&gt;&lt;br /&gt;Numbers from Nielsen last month indicated that Reunion.com, which says it receives 12 million unique visitors each month, is one of the fastest-growing social networks in the U.S. despite the fact that it's hardly on the radar of Twittering blog pundits. Its biggest demographic, according to Nielsen, is those between 55 and 64 who are looking to re-connect with friends and classmates.&lt;br /&gt;&lt;br /&gt;"Through this merger, we're redefining the people search space by bridging existing social networks and providing consumers with the tools they need to find, be found, and stay connected," Wink CEO Michael Tanne said in a release. "We're aiming to create an entirely new online experience that simplifies people's lives by making it easy to find and keep up with everyone they know. There will be exciting developments in the coming months as we integrate our strengths and push our business forward."&lt;br /&gt;&lt;br /&gt;&lt;a href="http://news.cnet.com/8301-13577_3-10080830-36.html"&gt;News Source&lt;/a&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8191367375415289842-7674440419866158270?l=webnology.blogspot.com'/&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://webnology.blogspot.com/feeds/7674440419866158270/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=8191367375415289842&amp;postID=7674440419866158270" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8191367375415289842/posts/default/7674440419866158270" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8191367375415289842/posts/default/7674440419866158270" /><link rel="alternate" type="text/html" href="http://webnology.blogspot.com/2008/11/people-search-sites-reunioncom-wink-to.html" title="People-search sites Reunion.com, Wink to merge" /><author><name>unni</name><uri>http://www.blogger.com/profile/07413941466960411392</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd="http://schemas.google.com/g/2005" name="OpenSocialUserId" value="18119052226690880461" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8191367375415289842.post-2123986556040585083</id><published>2008-11-03T05:24:00.000-08:00</published><updated>2008-11-03T05:32:01.955-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Technology News" /><title type="text">RockYou looks to Asia with new $17 million investment</title><content type="html">Investments to the tune of $17 million are a rarity these days, but app-factory RockYou has done just that: the San Francisco-based company has announced that Japanese mobile giant SoftBank and Korean telecom investment company SK Telecom Ventures have invested $17 million to create a new joint venture to build apps for the Asia-Pacific market.&lt;span class="fullpost"&gt;&lt;br /&gt;RockYou's Series C venture round, which pulled in $35 million, was in June--with the fresh $17 million, the company has raised $67 million so far.&lt;br /&gt;&lt;br /&gt;This marks the entry of RockYou, which is best known for its Facebook and MySpace widgets, into the mobile space. "In Asia, over half the social networking occurs on mobile," CEO Lance Tokuda told CNET News. "It's both Web and mobile, and we think we'll get good penetration. The results on (Chinese social network) Xiaonei so far have been very good." RockYou says it is the first non-Chinese company to build apps on Xiaonei.&lt;br /&gt;&lt;br /&gt;There will be a separate team handling RockYou's new Asia-Pacific operations, with operations coming from the new joint-venture investors as well. "In a lot of cases it's more cultural, where they'll take our assets and they'll port them and localize them," Tokuda said.&lt;br /&gt;&lt;br /&gt;But there will be synergy as well, with mobile apps likely coming to the U.S. market after they're released in Asia. SoftBank is the Japanese carrier for Apple's iPhone, and iPhone apps created for it may eventually be converted to U.S. versions.&lt;br /&gt;&lt;br /&gt;"We have no U.S. iPhone apps, and yes, we will port them back (from Asia)," Tokuda said.&lt;br /&gt;&lt;br /&gt;So is the company giving up on Facebook's platform? No, Tokuda said, adding that they plan to keep building for it. Nor is the round specifically designed as recession padding, he added.&lt;br /&gt;&lt;br /&gt;"There's still opportunity out there," he explained. "That said, it's good to raise a lot of money and have money in the bank, and this latest strategic round helps."&lt;br /&gt;&lt;br /&gt;&lt;a href="http://news.cnet.com/8301-13577_3-10080841-36.html"&gt;News Source&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8191367375415289842-2123986556040585083?l=webnology.blogspot.com'/&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://webnology.blogspot.com/feeds/2123986556040585083/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=8191367375415289842&amp;postID=2123986556040585083" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8191367375415289842/posts/default/2123986556040585083" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8191367375415289842/posts/default/2123986556040585083" /><link rel="alternate" type="text/html" href="http://webnology.blogspot.com/2008/11/rockyou-looks-to-asia-with-new-17.html" title="RockYou looks to Asia with new $17 million investment" /><author><name>unni</name><uri>http://www.blogger.com/profile/07413941466960411392</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd="http://schemas.google.com/g/2005" name="OpenSocialUserId" value="18119052226690880461" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8191367375415289842.post-5853207336894431401</id><published>2008-10-30T13:34:00.000-07:00</published><updated>2008-10-30T13:38:55.496-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="php" /><title type="text">Searching for All titles inside a directory of a page using PHP</title><content type="html">We have seen in Part 1 of this tutorial how to read the title tags of an html file. Now we will develop a script for reading all the title tags of the files present inside a directory. The basic script remains same and we will only be keeping this basic script within a while loop. This while loop will list all the files present inside a directory.&lt;br /&gt; &lt;span class="fullpost"&gt;&lt;br /&gt;You must read how in part 1 we have developed the code to handle a file in read mode and collect the text between title tags. Also read how the directory handler works to display all the files.&lt;br /&gt;&lt;br /&gt;Here is the code to handle the directory listing.&lt;br /&gt;&lt;br /&gt;$path="../dir-name/";// Right your path of the directory&lt;br /&gt;$handle=opendir($path);&lt;br /&gt;while (($file_name = readdir($handle))!==false) {&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;We can open files of particular type by using its extensions. Here we will use one if condition to add or exclude different types of files. ( read more on stristr())&lt;br /&gt;&lt;br /&gt;if(stristr($file_name,".php")){ // read the file now }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Rest of the code is same as part 1. So here is the complete code.&lt;br /&gt;&lt;br /&gt;&amp;lt;?&lt;br /&gt;///////////////function my_strip///////////&lt;br /&gt;function my_strip($start,$end,$total){&lt;br /&gt;$total = stristr($total,$start);&lt;br /&gt;$f2 = stristr($total,$end);&lt;br /&gt;return substr($total,strlen($start),-strlen($f2));&lt;br /&gt;}&lt;br /&gt;/////////////////////End of function my_strip ///&lt;br /&gt;///////////// Reading of file content////&lt;br /&gt;$i=0;&lt;br /&gt;$path="../dir-name/";// Right your path of the file&lt;br /&gt;&lt;br /&gt;$handle=opendir($path);&lt;br /&gt;while (($file_name = readdir($handle))!==false) {&lt;br /&gt;&lt;br /&gt;if(stristr($file_name,".php")){&lt;br /&gt;$url=$path.$file_name;&lt;br /&gt;&lt;br /&gt;$contents="";&lt;br /&gt;$fd = fopen ($url, "r"); // opening the file in read mode&lt;br /&gt;while($buffer = fread ($fd,1024)){&lt;br /&gt;$contents .=$buffer;&lt;br /&gt;}&lt;br /&gt;/////// End of reading file content ////////&lt;br /&gt;//////// We will start with collecting title part ///////&lt;br /&gt;$t=my_strip("&amp;lt;title&amp;gt;","&amp;lt;/title&amp;gt;",$contents);&lt;br /&gt;echo $t;&lt;br /&gt;echo "&amp;lt;br&amp;gt;";&lt;br /&gt;$i=$i+1;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;echo $i;&lt;br /&gt;?&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.plus2net.com/php_tutorial/file-search-dir.php"&gt;Article Source&lt;/a&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8191367375415289842-5853207336894431401?l=webnology.blogspot.com'/&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://webnology.blogspot.com/feeds/5853207336894431401/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=8191367375415289842&amp;postID=5853207336894431401" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8191367375415289842/posts/default/5853207336894431401" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8191367375415289842/posts/default/5853207336894431401" /><link rel="alternate" type="text/html" href="http://webnology.blogspot.com/2008/10/searching-for-all-titles-inside.html" title="Searching for All titles inside a directory of a page using PHP" /><author><name>unni</name><uri>http://www.blogger.com/profile/07413941466960411392</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd="http://schemas.google.com/g/2005" name="OpenSocialUserId" value="18119052226690880461" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8191367375415289842.post-8807251692379374441</id><published>2008-10-29T04:58:00.000-07:00</published><updated>2008-10-29T05:01:43.566-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="php" /><title type="text">Searching  for title inside a file using PHP</title><content type="html">We can collect the text written between two landmarks inside a file. These landmarks can be starting and ending of html tags. So what ever written within a tag can be copied or collected for further processing. Before we go for an example, read the tutorial on how to get part of a string by using one staring and ending strings.&lt;br /&gt; &lt;span class="fullpost"&gt;&lt;br /&gt;Let us try to understand this by an example. We will try to develop a script which will search and collect the text written within the title tags of a page. Read here if you want to know more about title tags in an html page. Here is an example of title tag.&lt;br /&gt;&amp;lt;title&amp;gt;This is the title text of a page&amp;lt;/title&amp;gt;&lt;br /&gt;&lt;br /&gt;As you can see within the page we can use starting and ending title tags or any pair of tags as two landmarks and collect the characters or string within it.&lt;br /&gt;&lt;br /&gt;Now let us learn how to open a file and read the content. Here is the code part to do that.&lt;br /&gt;&lt;br /&gt;$url="../dir-name/index.php";&lt;br /&gt;$contents="";&lt;br /&gt;$fd = fopen ($url, "r"); // opening the file in read mode&lt;br /&gt;while($buffer = fread ($fd,1024)){&lt;br /&gt;$contents .=$buffer;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Now as we have the content of the file stored in a variable $content , we will use our function my_strip ( read details about my_strip function here) to collect the title part only from the variable and print to the screen.&lt;br /&gt;&lt;br /&gt;$t=my_strip("&amp;lt;title&amp;gt;","&amp;lt;/title&amp;gt;",$contents);&lt;br /&gt;echo $t;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;With this we can give any URL and see the title of the file. This way like title tag we can read any other tag like meta keywords, meta description, body tag etc of a page. You can see many applications can be developed using this but let us try to develop few more things from this.&lt;br /&gt;&lt;br /&gt;First is reading all the files of a directory and displaying all the titles of the files inside that directory&lt;br /&gt;Second develop a hyperlink using these titles to query google for these titles. ( think why ? )&lt;br /&gt;&lt;br /&gt;The above two codes we will discuss in next section. Before that here is the full code as we discussed in the above tutorial.&lt;br /&gt;&lt;br /&gt;&amp;lt;?&lt;br /&gt;///////////////function my_strip///////////&lt;br /&gt;function my_strip($start,$end,$total){&lt;br /&gt;$total = stristr($total,$start);&lt;br /&gt;$f2 = stristr($total,$end);&lt;br /&gt;return substr($total,strlen($start),-strlen($f2));&lt;br /&gt;}&lt;br /&gt;/////////////////////End of function my_strip ///&lt;br /&gt;///////////// Reading of file content////&lt;br /&gt;$url="../dir-name/index.php";// Right your path of the file&lt;br /&gt;$contents="";&lt;br /&gt;$fd = fopen ($url, "r"); // opening the file in read mode&lt;br /&gt;while($buffer = fread ($fd,1024)){&lt;br /&gt;$contents .=$buffer;&lt;br /&gt;}&lt;br /&gt;/////// End of reading file content ////////&lt;br /&gt;//////// We will start with collecting title part ///////&lt;br /&gt;$t=my_strip("&amp;lt;title&amp;gt;","&amp;lt;/title&amp;gt;",$contents);&lt;br /&gt;echo $t;&lt;br /&gt;?&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Once we know the title text , we can go for str_ireplace command to replace the old title with new title and then write the content to file again.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.plus2net.com/php_tutorial/file-search.php"&gt;Article Source&lt;/a&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8191367375415289842-8807251692379374441?l=webnology.blogspot.com'/&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://webnology.blogspot.com/feeds/8807251692379374441/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=8191367375415289842&amp;postID=8807251692379374441" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8191367375415289842/posts/default/8807251692379374441" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8191367375415289842/posts/default/8807251692379374441" /><link rel="alternate" type="text/html" href="http://webnology.blogspot.com/2008/10/searching-for-title-inside-file-using.html" title="Searching  for title inside a file using PHP" /><author><name>unni</name><uri>http://www.blogger.com/profile/07413941466960411392</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd="http://schemas.google.com/g/2005" name="OpenSocialUserId" value="18119052226690880461" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8191367375415289842.post-3706445893583661565</id><published>2008-10-29T04:57:00.000-07:00</published><updated>2008-10-29T04:58:09.527-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="php" /><title type="text">Getting the last updated time of the file in PHP</title><content type="html">We can get the last updated date of any file by using filemtime function in PHP. This function returns date in UNIX Timestamp format and we can convert it to our requirement by using date function.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="fullpost"&gt;&lt;br /&gt;&lt;br /&gt;This function filemtime() uses the server file system so it works for local systems only, we can't use this function to get the modified time of any remote file system.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Here is the code to get the last modified date of any file. We are checking for a existing file ( test.php)&lt;br /&gt;&lt;br /&gt;echo date("m/d/Y",filemtime(“test.php”));&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The above code will display the modified date in month/day/year format.&lt;br /&gt;Note that we have used date function to convert the Unix Timestamp time returned by filemtime() function. &lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.plus2net.com/php_tutorial/filemtime.php"&gt;Article Source&lt;/a&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8191367375415289842-3706445893583661565?l=webnology.blogspot.com'/&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://webnology.blogspot.com/feeds/3706445893583661565/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=8191367375415289842&amp;postID=3706445893583661565" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8191367375415289842/posts/default/3706445893583661565" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8191367375415289842/posts/default/3706445893583661565" /><link rel="alternate" type="text/html" href="http://webnology.blogspot.com/2008/10/getting-last-updated-time-of-file-in.html" title="Getting the last updated time of the file in PHP" /><author><name>unni</name><uri>http://www.blogger.com/profile/07413941466960411392</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd="http://schemas.google.com/g/2005" name="OpenSocialUserId" value="18119052226690880461" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8191367375415289842.post-2097001120424124906</id><published>2008-10-29T04:48:00.000-07:00</published><updated>2008-10-29T04:52:38.215-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="php" /><title type="text">How to get the file name of the current loaded script using PHP ?</title><content type="html">We can get the current file name or the file executing the code by using SCRIPT_NAME. This will give us the path from the server root so the name of the current directory will also be included. Here is the code.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="fullpost"&gt;$file = $_SERVER["SCRIPT_NAME"];&lt;br /&gt;echo $file;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The above lines will print the present file name along with the directory name. For example if our current file is test.php and it is running inside my_file directory then the output of above code will be.&lt;br /&gt;&lt;br /&gt;/my_file/test.php&lt;br /&gt;&lt;br /&gt;We will add some more code to the above line to get the only file name from the above code. We will use explode command to break the string by using delimiter “/” .&lt;br /&gt;&lt;br /&gt;As the output of this explode command is an array then we will collect the last element of this array to get our file name. Here the index of last element of the array is total element of the array minus one, because the index of the elements start from 0 ( not from one ). So index of the last element of the array = total number of elements – 1&lt;br /&gt;&lt;br /&gt;Here is the code to get the last element of the array with the explode command to get the array.&lt;br /&gt;&lt;br /&gt;$break = Explode('/', $file);&lt;br /&gt;$pfile = $break[count($break) - 1];&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Here $pfile is the variable which will have the value of present file name.&lt;br /&gt;&lt;br /&gt;We can use $pfile in different application where current file name is required .&lt;br /&gt;&lt;br /&gt;Here is the complete code.&lt;br /&gt;&lt;br /&gt;$file = $_SERVER["SCRIPT_NAME"];&lt;br /&gt;$break = Explode('/', $file);&lt;br /&gt;$pfile = $break[count($break) - 1];&lt;br /&gt;&lt;br /&gt;echo $pfile;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.plus2net.com/php_tutorial/script-self.php"&gt;Article Source&lt;/a&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8191367375415289842-2097001120424124906?l=webnology.blogspot.com'/&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://webnology.blogspot.com/feeds/2097001120424124906/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=8191367375415289842&amp;postID=2097001120424124906" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8191367375415289842/posts/default/2097001120424124906" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8191367375415289842/posts/default/2097001120424124906" /><link rel="alternate" type="text/html" href="http://webnology.blogspot.com/2008/10/how-to-get-file-name-of-current-loaded.html" title="How to get the file name of the current loaded script using PHP ?" /><author><name>unni</name><uri>http://www.blogger.com/profile/07413941466960411392</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd="http://schemas.google.com/g/2005" name="OpenSocialUserId" value="18119052226690880461" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8191367375415289842.post-7126156612608016277</id><published>2008-10-29T04:45:00.000-07:00</published><updated>2008-10-29T04:46:21.972-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="php" /><title type="text">How to delete all the files in a directory using PHP ?</title><content type="html">We have seen how a file can be deleted by using unlink function in PHP. The same function can be used along with directory handler to list and delete all the files present inside. We have discussed how to display all the files present inside a directory. Now let us try to develop a function and to this function we will post directory name as parameter and the function will use unlink command to remove files by looping through all the files of the directory.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="fullpost"&gt;Here is the code to this.&lt;br /&gt;&lt;br /&gt;function EmptyDir($dir) {&lt;br /&gt;$handle=opendir($dir);&lt;br /&gt;&lt;br /&gt;while (($file = readdir($handle))!==false) {&lt;br /&gt;echo "$file&lt;br /&gt;";&lt;br /&gt;@unlink($dir.'/'.$file);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;closedir($handle);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;EmptyDir('images');&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Here images is the directory name we want to empty&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.plus2net.com/php_tutorial/php-files-delete.php"&gt;Article Source&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8191367375415289842-7126156612608016277?l=webnology.blogspot.com'/&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://webnology.blogspot.com/feeds/7126156612608016277/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=8191367375415289842&amp;postID=7126156612608016277" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8191367375415289842/posts/default/7126156612608016277" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8191367375415289842/posts/default/7126156612608016277" /><link rel="alternate" type="text/html" href="http://webnology.blogspot.com/2008/10/how-to-delete-all-files-in-directory.html" title="How to delete all the files in a directory using PHP ?" /><author><name>unni</name><uri>http://www.blogger.com/profile/07413941466960411392</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd="http://schemas.google.com/g/2005" name="OpenSocialUserId" value="18119052226690880461" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8191367375415289842.post-5699834459448605296</id><published>2008-10-29T04:42:00.000-07:00</published><updated>2008-10-29T04:44:16.388-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="php" /><title type="text">How to delete a file using PHP ?</title><content type="html">We can delete files by giving its URL or path in PHP by using unlink command. This command will work only if write permission is given to the folder or file. Without this the delete command will fail. Here is the command to delete the file.&lt;br /&gt;&lt;br /&gt;&lt;span class="fullpost"&gt;unlink($path);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Here $path is the relative path of the file calculated from the script execution. Here is an example of deleting file by using relative path&lt;br /&gt;&lt;br /&gt;$path="images/all11.css";&lt;br /&gt;if(unlink($path)) echo "Deleted file ";&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;We have used if condition to check whether the file delete command is successful or not. But the command below will not work.&lt;br /&gt;&lt;br /&gt;$path="http://domainname/file/red.jpg";&lt;br /&gt;if(unlink($path)) echo "Deleted file ";&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The warning message will say unlink() [function.unlink]: HTTP does not allow unlinking&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.plus2net.com/php_tutorial/php-file-delete.php"&gt;Article Source&lt;/a&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8191367375415289842-5699834459448605296?l=webnology.blogspot.com'/&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://webnology.blogspot.com/feeds/5699834459448605296/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=8191367375415289842&amp;postID=5699834459448605296" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8191367375415289842/posts/default/5699834459448605296" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8191367375415289842/posts/default/5699834459448605296" /><link rel="alternate" type="text/html" href="http://webnology.blogspot.com/2008/10/how-to-delete-file-using-php.html" title="How to delete a file using PHP ?" /><author><name>unni</name><uri>http://www.blogger.com/profile/07413941466960411392</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd="http://schemas.google.com/g/2005" name="OpenSocialUserId" value="18119052226690880461" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8191367375415289842.post-702903140787243060</id><published>2008-10-29T04:41:00.000-07:00</published><updated>2008-10-29T04:42:36.931-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="php" /><title type="text">How to write to a file using PHP</title><content type="html">We can write to a file by using fwrite() function PHP. Please note that we have to open the file in write mode and if write permission is there then only we can open it in write mode. If the file does not exist then one new file will be created. We can change the permission of the file also. You can read the content of a file by using fopen() function in PHP. This is the way to write entries to a guestbook, counter and many other scripts if you are not using any database for storing data. . Here we will see how to write to a file.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="fullpost"&gt;&amp;lt;?&lt;br /&gt;$body_content="This is my content"; // Store some text to enter inside the file&lt;br /&gt;$file_name="test_file.txt";               // file name&lt;br /&gt;$fp = fopen ($file_name, "w"); &lt;br /&gt;// Open the file in write mode, if file does not exist then it will be created.&lt;br /&gt;fwrite ($fp,$body_content);          // entering data to the file&lt;br /&gt;fclose ($fp);                                // closing the file pointer&lt;br /&gt;chmod($file_name,0777);           // changing the file permission.&lt;br /&gt;?&amp;gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8191367375415289842-702903140787243060?l=webnology.blogspot.com'/&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://webnology.blogspot.com/feeds/702903140787243060/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=8191367375415289842&amp;postID=702903140787243060" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8191367375415289842/posts/default/702903140787243060" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8191367375415289842/posts/default/702903140787243060" /><link rel="alternate" type="text/html" href="http://webnology.blogspot.com/2008/10/how-to-write-to-file-using-php.html" title="How to write to a file using PHP" /><author><name>unni</name><uri>http://www.blogger.com/profile/07413941466960411392</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd="http://schemas.google.com/g/2005" name="OpenSocialUserId" value="18119052226690880461" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8191367375415289842.post-3802113859533810835</id><published>2008-10-29T04:39:00.000-07:00</published><updated>2008-10-29T04:41:14.585-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="php" /><title type="text">PHP File open to read internal file</title><content type="html">WE can open a file or a URL to read by using fopen() function of PHP. While opening we can  give mode of file open ( read, write.. etc ). By using fopen we can read any external url also. We can write to a file by using fwrite function. Let us start with reading one internal file ( of the same site ). We have a file name as delete.htm. We will use the command fopen() to open the file in read mode.&lt;br /&gt;&lt;span class="fullpost"&gt;&lt;br /&gt;We will be using fread() function to read the content by using a file pointer. Fread() reads up to lengthbytes from the file pointer referenced  by fd. Reading stops when length bytes have been read or EOF is reached, whichever comes first.&lt;br /&gt;&lt;br /&gt;We have also used the function filesize() to know the size of the file and used it in the fread function.&lt;br /&gt;We will be using all these functions to read the content of another file and print the content as out put. Here is the code.&lt;br /&gt;&lt;br /&gt;&amp;lt;?&lt;br /&gt;$filename = "delete.htm"; // This is at root of the file using this script.&lt;br /&gt;$fd = fopen ($filename, "r"); // opening the file in read mode&lt;br /&gt;$contents = fread ($fd, filesize($filename)); // reading the content of the file&lt;br /&gt;fclose ($fd);               // Closing the file pointer&lt;br /&gt;echo $contents;              // printing the file content of the file&lt;br /&gt;?&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.plus2net.com/php_tutorial/php_file_open.php"&gt;Article Source&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8191367375415289842-3802113859533810835?l=webnology.blogspot.com'/&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://webnology.blogspot.com/feeds/3802113859533810835/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=8191367375415289842&amp;postID=3802113859533810835" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8191367375415289842/posts/default/3802113859533810835" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8191367375415289842/posts/default/3802113859533810835" /><link rel="alternate" type="text/html" href="http://webnology.blogspot.com/2008/10/php-file-open-to-read-internal-file.html" title="PHP File open to read internal file" /><author><name>unni</name><uri>http://www.blogger.com/profile/07413941466960411392</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd="http://schemas.google.com/g/2005" name="OpenSocialUserId" value="18119052226690880461" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8191367375415289842.post-8417719309491127682</id><published>2008-10-29T04:13:00.000-07:00</published><updated>2008-10-29T04:33:50.379-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="javascript" /><category scheme="http://www.blogger.com/atom/ns#" term="javascript tips" /><title type="text">JavaScript and memory leaks</title><content type="html">Credits: This tutorial is written by Volkan. He runs the site Sarmal.com, a bilingual site featuring all his work, products, services, and up-to-date profile information in English and Turkish.&lt;br /&gt;&lt;br /&gt;If you are developing client-side re-usable scripting objects, sooner or later you will find yourself spotting out memory leaks. Chances are that your browser will suck memory like a sponge and you will hardly be able to find a reason why your lovely DHTML navigation's responsiveness decreases severely after visiting a couple of pages within your site.&lt;br /&gt;&lt;br /&gt;&lt;span class="fullpost"&gt;A Microsoft developer Justing Rogers has described IE leak patterns in his excellent article.&lt;br /&gt;&lt;br /&gt;In this article, we will review those patterns from a slightly different perspective and support it with diagrams and memory utilization graphs. We will also introduce several subtler leak scenarios. Before we begin, I strongly recommend you to read that article if you have not already read.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Why does the memory leak?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The problem of memory leakage is not just limited to Internet Explorer.  Almost any browser (including but not limited to Mozilla, Netscape and Opera) will leak memory if you provide adequate conditions (and it is not that hard to do so, as we will see shortly). But (in my humble opinion, ymmv etc.) Internet Explorer is the king of leakers.&lt;br /&gt;&lt;br /&gt;Don't get me wrong. I do not belong to the crowd yelling "Hey IE has memory leaks, checkout this new tool [link-to-tool] and see for yourself". Let us discuss how crappy Internet Explorer is and cover up all the flaws in other browsers".&lt;br /&gt;&lt;br /&gt;Each browser has its own strengths and weaknesses. For instance, Mozilla consumes too much of memory at initial boot, it is not good in string and array operations; Opera may crash if you write a ridiculously complex DHTML script which confuses its rendering engine.&lt;br /&gt;&lt;br /&gt;Although we will be focusing on the memory leaking situations in Internet Explorer, this discussion is equally applicable to other browsers.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;A simple beginning&lt;/span&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;[Exhibit 1 - Memory leaking insert due to inline script]&lt;br /&gt;&lt;br /&gt;&amp;lt;html&amp;gt;&lt;br /&gt;&amp;lt;head&amp;gt;&lt;br /&gt;&amp;lt;script type="text/javascript"&amp;gt;&lt;br /&gt;function LeakMemory(){&lt;br /&gt;var parentDiv =&lt;br /&gt;    document.createElement("&amp;lt;div onclick='foo()'&amp;gt;");&lt;br /&gt;&lt;br /&gt;parentDiv.bigString = new Array(1000).join(&lt;br /&gt;                     new Array(2000).join("XXXXX"));&lt;br /&gt;}&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&amp;lt;/head&amp;gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;br /&gt;&amp;lt;input type="button"&lt;br /&gt;value="Memory Leaking Insert" onclick="LeakMemory()" /&amp;gt;&lt;br /&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;The first assignment  parentDiv=document.createElement(...); will create a div element and create a temporary scope for it where the scripting object resides. The second assignment  parentDiv.bigString=... attaches a large object to parentDiv. When LeakMemory() method is called, a DOM element will be created within the scope of this function, a very large object will be attached to it as a member property and the DOM element will be de-allocated and removed from memory as soon as the function exits, since it is an object created within the local scope of the function.&lt;br /&gt;&lt;br /&gt;When you run the example and click the button a few times, your memory graph will probably look like this:&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_VHplZu23whg/SQhF_zDSOLI/AAAAAAAAHas/E9C2H8MyBdE/s1600-h/Exhibit1.gif"&gt;&lt;img style="cursor: pointer; width: 320px; height: 294px;" src="http://4.bp.blogspot.com/_VHplZu23whg/SQhF_zDSOLI/AAAAAAAAHas/E9C2H8MyBdE/s320/Exhibit1.gif" alt="" id="BLOGGER_PHOTO_ID_5262533126920485042" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;h4&gt;Increasing the frequency&lt;/h4&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;No visible leak huh? What if we do this a few hundred times instead of twenty, or a few thousand times? Will it be the same? The following code calls the assignment over and over again to accomplish this goal:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;[Exhibit 2 - Memory leaking insert (frequency increased) ]&lt;br /&gt;&lt;br /&gt;&amp;lt;html&amp;gt;&lt;br /&gt;&amp;lt;head&amp;gt;&lt;br /&gt;&amp;lt;script type="text/javascript"&amp;gt;&lt;br /&gt;function LeakMemory(){&lt;br /&gt;for(i = 0; i &amp;lt; 5000; i++){&lt;br /&gt;    var parentDiv =&lt;br /&gt;       document.createElement("&amp;lt;div onClick='foo()'&amp;gt;");&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&amp;lt;/head&amp;gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;br /&gt;&amp;lt;input type="button"&lt;br /&gt;value="Memory Leaking Insert" onclick="LeakMemory()" /&amp;gt;&lt;br /&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;/blockquote&gt;And here follows the corresponding graph:&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_VHplZu23whg/SQhGqOe1d3I/AAAAAAAAHa0/GEoDwenk5cg/s1600-h/Exhibit2.gif"&gt;&lt;img style="cursor: pointer; width: 320px; height: 294px;" src="http://4.bp.blogspot.com/_VHplZu23whg/SQhGqOe1d3I/AAAAAAAAHa0/GEoDwenk5cg/s320/Exhibit2.gif" alt="" id="BLOGGER_PHOTO_ID_5262533855838304114" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;The ramp in the memory usage indicates leak in memory. The horizontal line (the last 20 seconds) at the end of the ramp is the memory after refreshing the page and loading another (about:blank) page. This shows that the leak is an actual leak and not a pseudo leak. The memory will not be reclaimed unless the browser window and other dependant windows if any are closed.&lt;br /&gt;&lt;br /&gt;Assume you have a dozen pages that have similar leakage graph. After a few hours, you may want to restart your browser (or even your PC) because it just stops responding. The naughty browser is eating up all your resources. However, this is an extreme case because Windows will increase the virtual memory size as soon as your memory consumption reaches a certain level.&lt;br /&gt;&lt;br /&gt;This is not a pretty scenario. Your client/boss will not be very happy, if they discover such a situation in the middle of a product showcase/training/demo.&lt;br /&gt;&lt;br /&gt;A careful eye may have caught that there is no bigString in the second example. This means that the leak is merely because of the internal scripting object (i.e. the anonymous script onclick='foo()'). This script was not deallocated properly. This caused memory leak at each iteration. To prove our thesis let us run a slightly different test case:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;[Exhibit 3 - Leak test without inline script attached]&lt;br /&gt;&lt;br /&gt;&amp;lt;html&amp;gt;&lt;br /&gt;&amp;lt;head&amp;gt;&lt;br /&gt;&amp;lt;script type="text/javascript"&amp;gt;&lt;br /&gt;function LeakMemory(){&lt;br /&gt;   for(i = 0; i &amp;lt; 50000; i++){&lt;br /&gt;       var parentDiv =&lt;br /&gt;       document.createElement("div");&lt;br /&gt;   }&lt;br /&gt;}&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&amp;lt;/head&amp;gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;br /&gt;&amp;lt;input type="button"&lt;br /&gt;  value="Memory Leaking Insert" onclick="LeakMemory()" /&amp;gt;&lt;br /&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;And here follows the corresponding memory graph:&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_VHplZu23whg/SQhHW8ak5LI/AAAAAAAAHa8/SEuolINNVOw/s1600-h/Exhibit3.gif"&gt;&lt;img style="cursor: pointer; width: 320px; height: 294px;" src="http://2.bp.blogspot.com/_VHplZu23whg/SQhHW8ak5LI/AAAAAAAAHa8/SEuolINNVOw/s320/Exhibit3.gif" alt="" id="BLOGGER_PHOTO_ID_5262534624082715826" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;JavaScript and memory leaks&lt;br /&gt;&lt;br /&gt;Credits: This tutorial is written by Volkan. He runs the site Sarmal.com, a bilingual site featuring all his work, products, services, and up-to-date profile information in English and Turkish.&lt;br /&gt;&lt;br /&gt;If you are developing client-side re-usable scripting objects, sooner or later you will find yourself spotting out memory leaks. Chances are that your browser will suck memory like a sponge and you will hardly be able to find a reason why your lovely DHTML navigation's responsiveness decreases severely after visiting a couple of pages within your site.&lt;br /&gt;&lt;br /&gt;A Microsoft developer Justing Rogers has described IE leak patterns in his excellent article.&lt;br /&gt;&lt;br /&gt;In this article, we will review those patterns from a slightly different perspective and support it with diagrams and memory utilization graphs. We will also introduce several subtler leak scenarios. Before we begin, I strongly recommend you to read that article if you have not already read.&lt;br /&gt;Why does the memory leak?&lt;br /&gt;&lt;br /&gt;The problem of memory leakage is not just limited to Internet Explorer. Almost any browser (including but not limited to Mozilla, Netscape and Opera) will leak memory if you provide adequate conditions (and it is not that hard to do so, as we will see shortly). But (in my humble opinion, ymmv etc.) Internet Explorer is the king of leakers.&lt;br /&gt;&lt;br /&gt;Don't get me wrong. I do not belong to the crowd yelling "Hey IE has memory leaks, checkout this new tool [link-to-tool] and see for yourself". Let us discuss how crappy Internet Explorer is and cover up all the flaws in other browsers".&lt;br /&gt;&lt;br /&gt;Each browser has its own strengths and weaknesses. For instance, Mozilla consumes too much of memory at initial boot, it is not good in string and array operations; Opera may crash if you write a ridiculously complex DHTML script which confuses its rendering engine.&lt;br /&gt;&lt;br /&gt;Although we will be focusing on the memory leaking situations in Internet Explorer, this discussion is equally applicable to other browsers.&lt;br /&gt;A simple beginning&lt;br /&gt;&lt;br /&gt;Let us begin with a simple example:&lt;br /&gt;&lt;br /&gt;&amp;lt;html&amp;gt;&lt;br /&gt;&amp;lt;head&amp;gt;&lt;br /&gt;&amp;lt;script type="text/javascript"&amp;gt;&lt;br /&gt; function LeakMemory(){&lt;br /&gt;     var parentDiv =&lt;br /&gt;          document.createElement("&amp;lt;div onclick='foo()'&amp;gt;");&lt;br /&gt;&lt;br /&gt;     parentDiv.bigString = new Array(1000).join(&lt;br /&gt;                           new Array(2000).join("XXXXX"));&lt;br /&gt; }&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&amp;lt;/head&amp;gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;br /&gt;&amp;lt;input type="button"&lt;br /&gt;    value="Memory Leaking Insert" onclick="LeakMemory()" /&amp;gt;&lt;br /&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;br /&gt;&lt;br /&gt;The first assignment parentDiv=document.createElement(...); will create a div element and create a temporary scope for it where the scripting object resides. The second assignment parentDiv.bigString=... attaches a large object to parentDiv. When LeakMemory() method is called, a DOM element will be created within the scope of this function, a very large object will be attached to it as a member property and the DOM element will be de-allocated and removed from memory as soon as the function exits, since it is an object created within the local scope of the function.&lt;br /&gt;&lt;br /&gt;When you run the example and click the button a few times, your memory graph will probably look like this:&lt;br /&gt;&lt;br /&gt;Increasing the frequency&lt;br /&gt;&lt;br /&gt;No visible leak huh? What if we do this a few hundred times instead of twenty, or a few thousand times? Will it be the same? The following code calls the assignment over and over again to accomplish this goal:&lt;br /&gt;&lt;br /&gt;[Exhibit 2 - Memory leaking insert (frequency increased) ]&lt;br /&gt;&lt;br /&gt;&amp;lt;html&amp;gt;&lt;br /&gt;&amp;lt;head&amp;gt;&lt;br /&gt;&amp;lt;script type="text/javascript"&amp;gt;&lt;br /&gt; function LeakMemory(){&lt;br /&gt;     for(i = 0; i &amp;lt; 5000; i++){&lt;br /&gt;         var parentDiv =&lt;br /&gt;            document.createElement("&amp;lt;div onClick='foo()'&amp;gt;");&lt;br /&gt;     }&lt;br /&gt; }&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&amp;lt;/head&amp;gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;br /&gt;&amp;lt;input type="button"&lt;br /&gt;    value="Memory Leaking Insert" onclick="LeakMemory()" /&amp;gt;&lt;br /&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;And here follows the corresponding graph:&lt;br /&gt;&lt;br /&gt;The ramp in the memory usage indicates leak in memory. The horizontal line (the last 20 seconds) at the end of the ramp is the memory after refreshing the page and loading another (about:blank) page. This shows that the leak is an actual leak and not a pseudo leak. The memory will not be reclaimed unless the browser window and other dependant windows if any are closed.&lt;br /&gt;&lt;br /&gt;Assume you have a dozen pages that have similar leakage graph. After a few hours, you may want to restart your browser (or even your PC) because it just stops responding. The naughty browser is eating up all your resources. However, this is an extreme case because Windows will increase the virtual memory size as soon as your memory consumption reaches a certain level.&lt;br /&gt;&lt;br /&gt;This is not a pretty scenario. Your client/boss will not be very happy, if they discover such a situation in the middle of a product showcase/training/demo.&lt;br /&gt;&lt;br /&gt;A careful eye may have caught that there is no bigString in the second example. This means that the leak is merely because of the internal scripting object (i.e. the anonymous script onclick='foo()'). This script was not deallocated properly. This caused memory leak at each iteration. To prove our thesis let us run a slightly different test case:&lt;br /&gt;&lt;br /&gt;[Exhibit 3 - Leak test without inline script attached]&lt;br /&gt;&lt;br /&gt;&amp;lt;html&amp;gt;&lt;br /&gt;&amp;lt;head&amp;gt;&lt;br /&gt;&amp;lt;script type="text/javascript"&amp;gt;&lt;br /&gt; function LeakMemory(){&lt;br /&gt;     for(i = 0; i &amp;lt; 50000; i++){&lt;br /&gt;         var parentDiv =&lt;br /&gt;         document.createElement("div");&lt;br /&gt;     }&lt;br /&gt; }&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&amp;lt;/head&amp;gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;br /&gt;&amp;lt;input type="button"&lt;br /&gt;    value="Memory Leaking Insert" onclick="LeakMemory()" /&amp;gt;&lt;br /&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;And here follows the corresponding memory graph:&lt;br /&gt;&lt;br /&gt;As you can see, we have done fifty thousand iterations instead of 5000, and still the memory usage is flat (i.e. no leaks). The slight ramp is due to some other process in my PC.&lt;br /&gt;&lt;br /&gt;Let us change our code in a more standard and somewhat unobtrusive manner (not the correct term here, but can't find a better one) without embedded inline scripts and re-test it.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.javascriptkit.com/javatutors/closuresleak/index.shtml"&gt;Article Source&lt;/a&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8191367375415289842-8417719309491127682?l=webnology.blogspot.com'/&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://webnology.blogspot.com/feeds/8417719309491127682/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=8191367375415289842&amp;postID=8417719309491127682" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8191367375415289842/posts/default/8417719309491127682" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8191367375415289842/posts/default/8417719309491127682" /><link rel="alternate" type="text/html" href="http://webnology.blogspot.com/2008/10/javascript-and-memory-leaks.html" title="JavaScript and memory leaks" /><author><name>unni</name><uri>http://www.blogger.com/profile/07413941466960411392</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd="http://schemas.google.com/g/2005" name="OpenSocialUserId" value="18119052226690880461" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/_VHplZu23whg/SQhF_zDSOLI/AAAAAAAAHas/E9C2H8MyBdE/s72-c/Exhibit1.gif" height="72" width="72" /><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8191367375415289842.post-880293579534107079</id><published>2008-10-29T04:09:00.000-07:00</published><updated>2008-10-29T04:12:48.021-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="javascript" /><category scheme="http://www.blogger.com/atom/ns#" term="javascript tips" /><category scheme="http://www.blogger.com/atom/ns#" term="css" /><title type="text">Dynamically removing/ replacing an external JavaScript or CSS file</title><content type="html">Any external JavaScript&lt;br /&gt;or CSS file, whether added manually or dynamically, can be removed from the page. The end result may not be fully what you had in mind, however. I'll talk about this a little later.&lt;br /&gt;&lt;span class="fullpost"&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Dynamically removing an external JavaScript&lt;br /&gt;or CSS file&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;To remove an external JavaScript or CSS file from a page, the key is to hunt them down first by traversing the DOM, then call DOM's  removeChild() method to do the hit job. A generic approach is to identify an external file to remove based on its file name, though there are certainly other approaches, such as by CSS class name. With that in mind, the below function removes any external JavaScript or CSS file based on the file name entered:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;function removejscssfile(filename, filetype){&lt;br /&gt; var targetelement=(filetype=="js")? "script" : (filetype=="css")? "link" : "none" //determine element type to create nodelist from&lt;br /&gt; var targetattr=(filetype=="js")? "src" : (filetype=="css")? "href" : "none" //determine corresponding attribute to test for&lt;br /&gt; var allsuspects=document.getElementsByTagName(targetelement)&lt;br /&gt; for (var i=allsuspects.length; i&gt;=0; i--){ //search backwards within nodelist for matching elements to remove&lt;br /&gt;  if (allsuspects[i] &amp;&amp; allsuspects[i].getAttribute(targetattr)!=null &amp;&amp; allsuspects[i].getAttribute(targetattr).indexOf(filename)!=-1)&lt;br /&gt;   allsuspects[i].parentNode.removeChild(allsuspects[i]) //remove element by calling parentNode.removeChild()&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;removejscssfile("somescript.js", "js") //remove all occurences of "somescript.js" on page&lt;br /&gt;removejscssfile("somestyle.css", "css") //remove all occurences "somestyle.css" on page&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;The function starts out by creating a collection out of either all "SCRIPT" or "LINK" elements on the page depending on the desired file type to remove. The corresponding attribute to look at also changes accordingly ("src" or "href" attribute). Then, the function sets out to loop through the gathered elements backwards to see if any of them match the name of the file that should be removed. There's a reason for the reversed direction- if/whenever an identified element is deleted, the collection collapses by one element each time, and to continue to cycle through the new collection correctly, reversing the direction does the trick (it may encounter undefined elements, hence the first check for allsuspects[i] in the if statement). Now, to delete the identified element, the DOM method  parentNode.removeChild() is called on it.&lt;br /&gt;&lt;br /&gt;So what actually happens when you remove an external JavaScript or CSS file? Perhaps not entirely what you would expect actually. In the case of JavaScript, while the element is removed from the document tree, any code loaded as part of the external JavaScript file remains in the browser's memory. That is to say, you can still access variables, functions etc that were added when the external file first loaded (at least in IE7 and Firefox 2.x). If you're looking to reclaim browser memory by removing an external JavaScript, don't rely on this operation to do all your work. With external CSS files, when you remove a file, the document does reflow to take into account the removed CSS rules, but unfortunately, not in IE7 (Firefox 2.x and Opera 9 do).&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;&lt;br /&gt;Dynamically replacing an external JavaScript or CSS file&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Replacing an external JavaScript or CSS file isn't much different than removing one as far as the process goes. Instead of calling  parentNode.removeChild(), you'll be using  parentNode.replaceChild() to do the bidding instead:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;function createjscssfile(filename, filetype){&lt;br /&gt; if (filetype=="js"){ //if filename is a external JavaScript file&lt;br /&gt;  var fileref=document.createElement('script')&lt;br /&gt;  fileref.setAttribute("type","text/javascript")&lt;br /&gt;  fileref.setAttribute("src", filename)&lt;br /&gt; }&lt;br /&gt; else if (filetype=="css"){ //if filename is an external CSS file&lt;br /&gt;  var fileref=document.createElement("link")&lt;br /&gt;  fileref.setAttribute("rel", "stylesheet")&lt;br /&gt;  fileref.setAttribute("type", "text/css")&lt;br /&gt;  fileref.setAttribute("href", filename)&lt;br /&gt; }&lt;br /&gt; return fileref&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;function replacejscssfile(oldfilename, newfilename, filetype){&lt;br /&gt; var targetelement=(filetype=="js")? "script" : (filetype=="css")? "link" : "none" //determine element type to create nodelist using&lt;br /&gt; var targetattr=(filetype=="js")? "src" : (filetype=="css")? "href" : "none" //determine corresponding attribute to test for&lt;br /&gt; var allsuspects=document.getElementsByTagName(targetelement)&lt;br /&gt; for (var i=allsuspects.length; i&gt;=0; i--){ //search backwards within nodelist for matching elements to remove&lt;br /&gt;  if (allsuspects[i] &amp;&amp; allsuspects[i].getAttribute(targetattr)!=null &amp;&amp; allsuspects[i].getAttribute(targetattr).indexOf(oldfilename)!=-1){&lt;br /&gt;   var newelement=createjscssfile(newfilename, filetype)&lt;br /&gt;   allsuspects[i].parentNode.replaceChild(newelement, allsuspects[i])&lt;br /&gt;  }&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;replacejscssfile("oldscript.js", "newscript.js", "js") //Replace all occurences of "oldscript.js" with "newscript.js"&lt;br /&gt;replacejscssfile("oldstyle.css", "newstyle", "css") //Replace all occurences "oldstyle.css" with "newstyle.css"&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Notice the helper function createjscssfile(), which is essentially just a duplicate of loadjscssfile() as seen on the previous page, but modified to return the newly created element instead of actually adding it to the page. It comes in handy when  parentNode.replaceChild() is called in replacejscssfile() to replace the old element with the new. Some good news here- when you replace one external CSS file with another, all browsers, including IE7, will reflow the document automatically to take into account the new file's CSS rules.&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;&lt;br /&gt;Conclusion&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;So when is all this useful? Well, in today's world of Ajax&lt;br /&gt;and ever larger web applications&lt;br /&gt;, being able to load accompanying JavaScript/ CSS files asynchronously and on demand is not only handy, but in some cases, necessary. Have fun finding out what they are, or implementing the technique. :)&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.javascriptkit.com/javatutors/loadjavascriptcss2.shtml"&gt;Article Source&lt;/a&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8191367375415289842-880293579534107079?l=webnology.blogspot.com'/&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://webnology.blogspot.com/feeds/880293579534107079/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=8191367375415289842&amp;postID=880293579534107079" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8191367375415289842/posts/default/880293579534107079" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8191367375415289842/posts/default/880293579534107079" /><link rel="alternate" type="text/html" href="http://webnology.blogspot.com/2008/10/dynamically-removing-replacing-external.html" title="Dynamically removing/ replacing an external JavaScript or CSS file" /><author><name>unni</name><uri>http://www.blogger.com/profile/07413941466960411392</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd="http://schemas.google.com/g/2005" name="OpenSocialUserId" value="18119052226690880461" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8191367375415289842.post-5521148918324934405</id><published>2008-10-29T04:01:00.000-07:00</published><updated>2008-10-29T04:08:58.708-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="javascript" /><category scheme="http://www.blogger.com/atom/ns#" term="javascript tips" /><category scheme="http://www.blogger.com/atom/ns#" term="css" /><title type="text">Dynamically loading an external JavaScript or CSS file</title><content type="html">The conventional way to loading external JavaScript (ie: .js) and CSS (ie: .css) files on a page is to stick a reference to them in the HEAD section of your page, for example:&lt;br /&gt;&lt;br /&gt;&lt;span class="fullpost"&gt;&lt;blockquote&gt;&amp;lt;head&amp;gt;&lt;br /&gt;&amp;lt;script type="text/javascript" src="myscript.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&amp;lt;link rel="stylesheet" type="text/css" href="main.css" /&amp;gt;&lt;br /&gt;&amp;lt;/head&amp;gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Files that are called this way are added to the page as they are encountered in the page's source, or synchronously. For the most part, this setup meets our needs just fine, though in the world of synchronous Ajax design patterns, the ability to also fire up JavaScript/ CSS on demand&lt;br /&gt;is becoming more and more handy. In this tutorial, lets see how it's done.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Dynamically loading external JavaScript and CSS files&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;To load a .js or .css file dynamically, in a nutshell, it means using DOM methods to first create a swanky new "SCRIPT" or "LINK" element, assign it the appropriate attributes, and finally, use element.appendChild() to add the element to the desired location within the document tree. It sounds a lot more fancy than it really is. Lets see how it all comes together:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;function loadjscssfile(filename, filetype){&lt;br /&gt; if (filetype=="js"){ //if filename is a external JavaScript file&lt;br /&gt;  var fileref=document.createElement('script')&lt;br /&gt;  fileref.setAttribute("type","text/javascript")&lt;br /&gt;  fileref.setAttribute("src", filename)&lt;br /&gt; }&lt;br /&gt; else if (filetype=="css"){ //if filename is an external CSS file&lt;br /&gt;  var fileref=document.createElement("link")&lt;br /&gt;  fileref.setAttribute("rel", "stylesheet")&lt;br /&gt;  fileref.setAttribute("type", "text/css")&lt;br /&gt;  fileref.setAttribute("href", filename)&lt;br /&gt; }&lt;br /&gt; if (typeof fileref!="undefined")&lt;br /&gt;  document.getElementsByTagName("head")[0].appendChild(fileref)&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;loadjscssfile("myscript.js", "js") //dynamically load and add this .js file&lt;br /&gt;loadjscssfile("javascript.php", "js") //dynamically load "javascript.php" as a JavaScript file&lt;br /&gt;loadjscssfile("mystyle.css", "css") ////dynamically load and add this .css file&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Since external JavaScript and CSS files can technically end with any custom file extension (ie: "javascript.php"), the function parameter "filetype" lets you tell the script what file type to expect before loading. After that, the function sets out to create the element using the appropriate DOM methods, assign it the proper attributes, and finally, add it to the end of the HEAD section. Now, where the created file gets added is worth elaborating on:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;document.getElementsByTagName("head")[0].appendChild(fileref)&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;By referencing the HEAD element of the page first and then calling appendChild(), this means the newly created element is added to the very end of the HEAD tag. Furthermore, you should be aware that no existing element is harmed in the adding of the new element- that is to say, if you call loadjscssfile("myscript.js", "js") twice, you now end up with two new "SCRIPT" elements both pointing to the same JavaScript file. This is problematic only from an efficiency standpoint, as you'll be adding redundant elements to the page and using unnecessary browser memory in the process. A simple way to prevent the same file from being added more than once is to keep track of the files added by loadjscssfile(), and only load a file if it's new:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;var filesadded="" //list of files already added&lt;br /&gt;&lt;br /&gt;function checkloadjscssfile(filename, filetype){&lt;br /&gt; if (filesadded.indexOf("["+filename+"]")==-1){&lt;br /&gt;  loadjscssfile(filename, filetype)&lt;br /&gt;  filesadded+="["+filename+"]" //List of files added in the form "[filename1],[filename2],etc"&lt;br /&gt; }&lt;br /&gt; else&lt;br /&gt;  alert("file already added!")&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;checkloadjscssfile("myscript.js", "js") //success&lt;br /&gt;checkloadjscssfile("myscript.js", "js") //redundant file, so file not added&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Here I'm just crudely detecting to see if a file that's set to be added already exists within a list of added files' names stored in variable  filesadded before deciding whether to proceed or not.&lt;br /&gt;&lt;br /&gt;Ok, moving on, sometimes the situation may require that you actually remove or replace an added .js or .css file. Lets see how that's done next.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.javascriptkit.com/javatutors/loadjavascriptcss.shtml"&gt;Article Source&lt;/a&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8191367375415289842-5521148918324934405?l=webnology.blogspot.com'/&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://webnology.blogspot.com/feeds/5521148918324934405/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=8191367375415289842&amp;postID=5521148918324934405" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8191367375415289842/posts/default/5521148918324934405" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8191367375415289842/posts/default/5521148918324934405" /><link rel="alternate" type="text/html" href="http://webnology.blogspot.com/2008/10/dynamically-loading-external-javascript.html" title="Dynamically loading an external JavaScript or CSS file" /><author><name>unni</name><uri>http://www.blogger.com/profile/07413941466960411392</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd="http://schemas.google.com/g/2005" name="OpenSocialUserId" value="18119052226690880461" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8191367375415289842.post-8491562285472698789</id><published>2008-10-28T08:13:00.000-07:00</published><updated>2008-10-28T08:20:21.433-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="html" /><title type="text">Introduction to HTML</title><content type="html">Are you new to HTML ? OK we will try to learn this language of internet here. HTML stands for Hyper Text Markup Language. You may be knowing other computer languages like C, C++, Basic, Foxpro etc and now one more language in this line is HTML. But there is a difference here, like other languages HTML is not a scripting language or a compiled code for the computers to execute. HTML is mostly consist of tags which we will use in our text document for the web browser to understand. Let us discuss one simple example. We want some part of the following line to be written in bold letters and some part in Italic letters.&lt;br /&gt;&lt;br /&gt;&lt;span class="fullpost"&gt;HTML is the language of the internet.&lt;br /&gt;&lt;br /&gt;In your word processor software you can easily do this but please note that there has to be a standard way of doing this which can be easily understood by browser operating at different platforms. So one universal way of formatting the text is required here for easy understanding of browsers operating on across the platforms. So in HTML we will write the above line in this way.&lt;br /&gt;&lt;br /&gt;HTML is the &amp;lt;b&amp;gt;language&amp;lt;/b&amp;gt; of the &amp;lt;i&amp;gt;internet&amp;lt;/i&amp;gt; &lt;br /&gt;&lt;br /&gt;Here once this text is opened by the user browser it can understand the format and it display the text by taking care of the tags used. So the tags plays important role in formatting the text in an html document. The user browser interprets the tags and display in required format.&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;&lt;br /&gt;View Source of the html page&lt;/span&gt;&lt;br /&gt;As the browsers display the text it gives an option to the user to view the source of the page or the text with tags. This feature is available by visiting View &gt; Source at top menu in internet explorer and View &gt; Page Source in Firefox browser. This way we can see the html formatted text of any site.&lt;br /&gt;&lt;br /&gt;Let us try for your first html page now.&lt;br /&gt;&lt;br /&gt;Open your note pad or any other text editor. Copy and paste the following code inside it. &lt;br /&gt;&lt;br /&gt;&amp;lt;html&amp;gt;&lt;br /&gt;&amp;lt;head&amp;gt;&lt;br /&gt;&amp;lt;title&amp;gt;(Type a title for your page here)&amp;lt;/title&amp;gt;&lt;br /&gt;&amp;lt;META NAME="DESCRIPTION" CONTENT=" "&amp;gt;&lt;br /&gt;&amp;lt;META NAME="KEYWORDS" CONTENT=" "&amp;gt;&lt;br /&gt;&amp;lt;/head&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;body &amp;gt;&lt;br /&gt;&lt;br /&gt;Hello &amp;lt;br&amp;gt;&lt;br /&gt;Welcome to plus2net.com&lt;br /&gt;&lt;br /&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;br /&gt;&lt;br /&gt;Save this as test.htm. In Win Note pad take care that you enter the file name with quotes like this “test.htm”. Open this file in your browser ( or just double click the file in your file explorer ) .&lt;br /&gt;&lt;br /&gt;You will see a message like this&lt;br /&gt;&lt;br /&gt;Hello&lt;br /&gt;Welcome to plus2net.com&lt;br /&gt;&lt;br /&gt;Note the line break between Hello and Welcome to plus2net.com. We have used one line break tag &lt;br&gt; and browser has placed a line break after reading this line break tag. Now from the browser menu visit View &gt; Source . You can see your original source code there.&lt;br /&gt;&lt;br /&gt;Try to develop more such pages by using different tags.&lt;br /&gt;Discuss this tutorial at forum&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.plus2net.com/html_tutorial/b-guide.php"&gt;Source&lt;/a&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8191367375415289842-8491562285472698789?l=webnology.blogspot.com'/&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://webnology.blogspot.com/feeds/8491562285472698789/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=8191367375415289842&amp;postID=8491562285472698789" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8191367375415289842/posts/default/8491562285472698789" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8191367375415289842/posts/default/8491562285472698789" /><link rel="alternate" type="text/html" href="http://webnology.blogspot.com/2008/10/introduction-to-html.html" title="Introduction to HTML" /><author><name>unni</name><uri>http://www.blogger.com/profile/07413941466960411392</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd="http://schemas.google.com/g/2005" name="OpenSocialUserId" value="18119052226690880461" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8191367375415289842.post-8706388952975986198</id><published>2008-10-28T08:07:00.000-07:00</published><updated>2008-10-28T08:12:36.938-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="html" /><title type="text">How to open pages in new window</title><content type="html">We move from one page to other page of a web site by using hyper links or simply links. These links on clicking opens the new page in same window. Links can have absolute URL or relative URL or the address of the page we want to move. To get the full details on different types of links visit hyper link page.&lt;br /&gt;&lt;br /&gt;&lt;span class="fullpost"&gt;While designing hyper links we can create links to open the new page in a new window. This way we can keep the existing window open with out disturbing the current page. In your website you may not like your visitors to click any external link and leave your site. So you can modify the link and tell the browser to open the external site in a new window. Here is a simple link&lt;br /&gt;&lt;br /&gt;&lt;a href=http://www.newsite.com&gt;new site&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;To the above query we will add a new component saying target=new or target = blank. Like this&lt;br /&gt;&lt;br /&gt;&lt;a href=http://www.newsite.com target='_new'&gt;new site&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Or&lt;br /&gt;&lt;br /&gt;&lt;a href=http://www.newsite.com target='_blank'&gt;new site&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Here are two links, one will open the html tutorial list in same page, and other will open the same page by opening a new window.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8191367375415289842-8706388952975986198?l=webnology.blogspot.com'/&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://webnology.blogspot.com/feeds/8706388952975986198/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=8191367375415289842&amp;postID=8706388952975986198" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8191367375415289842/posts/default/8706388952975986198" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8191367375415289842/posts/default/8706388952975986198" /><link rel="alternate" type="text/html" href="http://webnology.blogspot.com/2008/10/how-to-open-pages-in-new-window.html" title="How to open pages in new window" /><author><name>unni</name><uri>http://www.blogger.com/profile/07413941466960411392</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd="http://schemas.google.com/g/2005" name="OpenSocialUserId" value="18119052226690880461" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8191367375415289842.post-460570041306159793</id><published>2008-10-28T08:03:00.000-07:00</published><updated>2008-10-28T08:06:29.016-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="XHTML" /><category scheme="http://www.blogger.com/atom/ns#" term="Semantic Web" /><title type="text">Microformats vs. RDF: How Microformats Relate to the Semantic Web</title><content type="html">Microformats are a wildly popular set of formats for embedding metadata within normal XHTML. The primary advantage Microformats offer over RDF (including its embedded serializations) is that you can embed metadata directly in the XHTML, reducing the amount of markup you need to write (e.g. you don't have to write XHTML and additional RDF). Many people have contended that Microformats are a possible replacement for RDF, however Microformats were not designed to cover the same scope as RDF was. While both Microformats and RDF make it possible to store data about data, they simply do not work to solve the same set of problems.&lt;span class="fullpost"&gt;&lt;span style="font-weight:bold;"&gt;A quick comparison&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I don't blame the Microformats people for this confusion over what Microformats are or are not. Rather, I blame the sensationalists and know-nots that tend to jump on any new standard, format, or design pattern. Directly on the Microformats about page you are told what Microformats are and are not.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;What Microformats were not intended to be:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;    * A new language&lt;br /&gt;    * Infinitely extensible and open-ended&lt;br /&gt;    * An attempt to get everyone to change their behavior and rewrite their tools&lt;br /&gt;    * A whole new approach that throws away what already works today&lt;br /&gt;    * A panacea for all taxonomies, ontologies, and other such abstractions&lt;br /&gt;    * Defining the whole world, or even just boiling the ocean&lt;br /&gt;    * Any of the above &lt;br /&gt;&lt;br /&gt;There you have it, clearly stated and all. I would guess that most of the arguments made by pro-RDF people are extinguished after reading that unordered list. However some people still believe that we can create the Semantic Web with Microformats.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;What RDF allows (and Microformats lacks):&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;    * Resources are represented as URIs, allowing you to access metadata remotely&lt;br /&gt;    * Infinitely extensible and open-ended design&lt;br /&gt;    * A powerful Ontology language (OWL) that is built upon it&lt;br /&gt;    * The ability to utilize, share, and extend any number of vocabularies&lt;br /&gt;    * No reliance on pre-defined "formats" (i.e. not limited by the types of data that can be encoded) &lt;br /&gt;&lt;br /&gt;As you can see there are a few things we can do with RDF that cannot be done with Microformats. The Semantic Web relies on the things I've listed above. These are the clear-cut reasons why Microformats will not be part of the W3C's Semantic Web vision.&lt;br /&gt;Persisting the data within Microformats&lt;br /&gt;&lt;br /&gt;Another issue I've thought about is how we are to persist the data we glean from Microformats. How do you usefully store Microformat metadata (beyond leaving it in its XHTML form)? The information stored in Microformats eventually comes out in triple form, one way or the other. Take a look at this example:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;span class="tel"&gt;&lt;br /&gt; &lt;span class="type"&gt;home&lt;/span&gt;: &lt;br /&gt; &lt;span class="value"&gt;+1.415.555.1212&lt;/span&gt; &lt;br /&gt; &lt;/span&gt; &lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;What information can be gleaned from this example? Well, the home telephone number (of an unknown person or entity, in this example) is +1.415.555.1212. In the end we are still getting the subject-predicate-object form. In this case the subject would be the owner of that number, the predicate would be "home," and the object is the telephone number itself.&lt;br /&gt;&lt;br /&gt;So really, we will likely require triple storage for either RDF or Microformats. In all honesty, I don't know of any Microformat-stores. If you know of some, I would like to know if they are any different from a normal triple-store.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Microformats have a place and a purpose&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;At this point I'd like to say that Microformats do have a number of qualities that RDF (although not necessarily all serializations) does not accommodate for, at least not in the same way:&lt;br /&gt;&lt;br /&gt;    * Designed for humans first, machines second&lt;br /&gt;    * Modularity / embeddability&lt;br /&gt;    * Enables and encourages decentralized development, content, services&lt;br /&gt;    * A design principles for formats&lt;br /&gt;    * Adapted to current behaviors and usage patterns&lt;br /&gt;    * Highly correlated with semantic XHTML &lt;br /&gt;&lt;br /&gt;I've stated before that I believe Microformats will help bring about the Semantic Web by introducing "metadata sprinkling" (the act of including metadata in otherwise "normal" data) to more people. They allow for simple metadata embeddability and do not affect how an XHTML document validates. This is the kind of approach that will help normal users come closer to understanding the Semantic Web vision.&lt;br /&gt;Conclusions&lt;br /&gt;&lt;br /&gt;To me, Microformats are to RDF as HTML 5 is to XHTML; on the surface they both appear to be a solution to the same problem, but the former misses the point as to why the latter was created. On the very same about page I cited earlier there is a bullet point that suggests that Microformats will be part of the semantic web (note the lowercase letters, implying a semantic web, not the one envisioned by the W3C). I find that all competing Semantic Web development paths fall short of creating an entirely linked Semantic Web. The kind of Semantic Web that gives us a platform to stand on above the Web document layer. Microformats have their place, just not as a replacement to RDF.&lt;br /&gt; &lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8191367375415289842-460570041306159793?l=webnology.blogspot.com'/&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://webnology.blogspot.com/feeds/460570041306159793/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=8191367375415289842&amp;postID=460570041306159793" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8191367375415289842/posts/default/460570041306159793" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8191367375415289842/posts/default/460570041306159793" /><link rel="alternate" type="text/html" href="http://webnology.blogspot.com/2008/10/microformats-vs-rdf-how-microformats.html" title="Microformats vs. RDF: How Microformats Relate to the Semantic Web" /><author><name>unni</name><uri>http://www.blogger.com/profile/07413941466960411392</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd="http://schemas.google.com/g/2005" name="OpenSocialUserId" value="18119052226690880461" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></entry></feed>
