Truncate last N lines of a file using PHP

For one of my project I needed to remove certain footer / tail-end lines from the file to make it clean as it was containing some summary of records within the file. Because if I do that it can be directly loaded into database by LOAD DATA command. To remove lines from the end of file you can use following snippet of code:

Simple / Plain Ajax – without any JavaScript library

Yes, we are in the world of AJAX where we don’t live without jQuery, Prototype or Mootools but when it comes to explaining someone that how raw ajax works, you need an example of plain AJAX which we have been using 5 years back when these libraries were either just born and were not as famous as today. Because my favorite jQuery has become a de facto standard when it comes to DOM manipulation or AJAX.

Recently I have to give an example to one of my friend on how raw AJAX works and here I am sharing that sample with my blog readers as a reference.

jQuery case-insensitive Contains Expression..!

Most of the time to search through DOM and filter text we need a jQuery Expression/filter which gives us case-insensitive result. I believe it’s required to have it as a part of jQuery base-library but anyway writing your own is very simple.

I have gone through some of other implementation before writing this but here this version is complete copy of jQuery library’s “contains” filter except it is case-insensitive.

jQuery or non-jQuery Calendar Schedulers

If you’re looking for Google-like Calendar for your next web-application than, here is list of jQuery/ non-jQuery but Javascript based Calendar Schedulers which you can use in your web-application to provide scheduling and/or even calendars.

Netbeans 7.0 RC1 Released

Netbeans has been one of my favorite IDE for PHP, I have been using it in my day to day usage for most of my projects. I have been using Netbeans since 6.x. I know it’s Java based IDE which needs powerful machine just like Eclipse. But some of the feature it offers are even not available in commercial competitors. One of the best feature is “Quick Search”, the way it provides search through list of file is awesome. Something similar I have seen is in JetBrains PHPStorm but could not find it in Enterprise class Eclipse.

jQuery 1.5.2 and jQuery mobile alpha 4 released

jQuery 1.5.2 is released (on April 2nd) as a bug-fix release of jQuery version 1.5.x, fixing about 18+ issues/bugs reported. Along with that couple of days back on 31st March 2011 jQuery Mobile’s alpha-4 version has been released.

jQuery mobile project is making good and steady progress though from their road-map published earlier I was expecting production ready release of jQuery mobile in Jan 2011. As I have invested into jQuery mobile as a technology and tool for one of my project and it’s obvious that I can not release that when framework itself is not mature for production.

Reading MSSQL BLOG column data with PHP

I was working on a migration script to transfer data from legacy desktop software to Portal we have developed. While migrating attachments (stored as TIFF files) in BLOB (Long Binary) in Microsoft SQL Database Server using PHP it was not a cake-walk. When I observed every time it was creating a file of same size (4KB). I quickly understood that there is some limitation (of size) for reading records in PHP configuration.