In the programming world there are quite a few well understood and explored data structures. Which are commonly used in tons of applications, still the only things PHP offered till 5.3 in regards to structuring data were arrays (more precise: hash tables) and objects. So people had to either abuse them for other structures or implement the structures themselves on top of these. Thanks to Etienne things now are changing and PHP's Standard PHP Library (SPL) extension will offer quite a few standard implementations of data structures. The implemented data structures are implemented using these classes:
* SplDoublyLinkedList
* SplStack
* SplQueue (SplPriorityQueue)
* SplHeap (SplMinHeap, SplMaxHeap)
* SplFixedArray
For more details head over at http://schlueters.de/blog/archives/90-Data-structures-in-PHP-5.3.html
Tuesday, December 23, 2008
Wednesday, December 17, 2008
Usage of IF condition in mysql
Scenario:
Suppose we have the field in the table lets say status which has the ENUM value ACTIVE,INACTIVE.Usually after getting the value of this field(through the query)
we used to write return ($result['status']=='ACTIVE')?1:0 in class methods.
Here we are getting the db result array and based on the check(ACTIVE/INACTIVE) we are returning the boolean value.Instead of that we can have that check in the query itself like below
SELECT IF(status='ACTIVE',1,0) AS statuscheck from table1
Note that in the condition we need to give single equal symbol
so the code return ($result['status']=='ACTIVE')?1:0 will be replaced by return $result['statuscheck'].
Suppose we have the field in the table lets say status which has the ENUM value ACTIVE,INACTIVE.Usually after getting the value of this field(through the query)
we used to write return ($result['status']=='ACTIVE')?
Here we are getting the db result array and based on the check(ACTIVE/INACTIVE) we are returning the boolean value.Instead of that we can have that check in the query itself like below
SELECT IF(status='ACTIVE',1,0) AS statuscheck from table1
Note that in the condition we need to give single equal symbol
so the code return ($result['status']=='ACTIVE')?
Tuesday, December 16, 2008
Google Turns its Back on Firefox
About a month ago, Google dropped StarOffice from the Google Pack, a downloadable package of free Internet and productivity software for Windows users. StarOffice is a desktop office suite based on the open source OpenOffice.org program and distribute by Sun, and we theorized that Google was laying the ground work for a future push to get users to dump their desktop software in favor of Google’s own web-based application offerings.
For more details head over at http://www.sitepoint.com/blogs/2008/12/15/google-turns-its-back-on-firefox/
For more details head over at http://www.sitepoint.com/blogs/2008/12/15/google-turns-its-back-on-firefox/
Friday, December 12, 2008
CodeIgniter - Open source PHP web application framework
For more details check it in http://roshanbh.com.np/2008/12/codeigniter-programmer-php.html
Monday, December 1, 2008
Introduction To Xajax
The Xajax library provides a useful and simple method of generating asynchronous requests with next to not knowledge of javascript. All the javascript code is generated internally and leaves the developer to simply implement PHP functions. This tutorials is an absolute basic beginners guide to getting started with xajax. Full source code is provided with an explaination of how the process works.
More details on this, check it on http://www.phpro.org/tutorials/Introduction-To-Xajax.html
More details on this, check it on http://www.phpro.org/tutorials/Introduction-To-Xajax.html
Friday, November 28, 2008
Quick and Easy Graphing with the Google Chart API
Google has created an API for displaying the data in terms of chart which will be helpful in visualizing the data for reporting.For more details head over at http://www.sitepoint.com/blogs/2008/11/28/quick-and-easy-graphing-with-the-google-chart-api/
Tuesday, November 25, 2008
Application Configuration
PHP applications come in many shapes and sizes. Some used locally from command line, and more commonly, for web based applications. More often than not, regardless of size or type, some form of configuration variables will be stored for global access. Usually these configuration options are held in one of these four types of containers.
* ini file
* XML file
* PHP file
* Database
Each options has its pros and cons. Here each of these options is explored to see which method is right for your application.
For more details head over at http://www.phpro.org/articles/Application-Configuration.html
* ini file
* XML file
* PHP file
* Database
Each options has its pros and cons. Here each of these options is explored to see which method is right for your application.
For more details head over at http://www.phpro.org/articles/Application-Configuration.html
Tuesday, November 18, 2008
GROUP_CONCAT in MySQL
I had the scenario for the table like below.
Table: test
id title
_________________
1 T2
1 T3
1 T1
2 L2
2 L1
I want the results like
id title
_________________
1 T2,T3,T1
2 L2,L1
For this, SQL would be
select id,GROUP_CONCAT('title') from test GROUP BY id ORDER by id
Now i want the values of title to be sorted.
This can be done using the below query
select id,GROUP_CONCAT('title' ORDER BY title) from test GROUP BY id ORDER by id
The results would be
id title
_________________
1 T1,T2,T3
2 L1,L2
Table: test
id title
_________________
1 T2
1 T3
1 T1
2 L2
2 L1
I want the results like
id title
_________________
1 T2,T3,T1
2 L2,L1
For this, SQL would be
select id,GROUP_CONCAT('title') from test GROUP BY id ORDER by id
Now i want the values of title to be sorted.
This can be done using the below query
select id,GROUP_CONCAT('title' ORDER BY title) from test GROUP BY id ORDER by id
The results would be
id title
_________________
1 T1,T2,T3
2 L1,L2
Tuesday, October 21, 2008
Some useful Linux commands
Zipping the contents
tar -cvzf Destination folder Source folder from where files need to copy
Extracting the contents
tar -xvzf Source folder to extract
Zip the contents excluding the folders
tar -cvzf Destination folder Source folder from where files need to copy
--exclude="contents" --exclude="tmp"
To delete all occurance of files start with some extension
Eg:
find . -name ".svn" -exec rm -rf {} \;
tar -cvzf Destination folder Source folder from where files need to copy
Extracting the contents
tar -xvzf Source folder to extract
Zip the contents excluding the folders
tar -cvzf Destination folder Source folder from where files need to copy
--exclude="contents" --exclude="tmp"
To delete all occurance of files start with some extension
Eg:
find . -name ".svn" -exec rm -rf {} \;
Tuesday, September 23, 2008
Handling the Javascript Errors
1.Method using onerror event
onerror=handleErrors; //Invoke the method here
//Method definition
function handleErrors(msg,url,lineno)
{
//Here we will get the error message along with page url with lineno so tracking the error will be easier
//Handle the error here
return true or false
}
2.Try and Catch block
try
{
//Run some code here
}
catch(err)
{
//Handle errors using error object
}
onerror=handleErrors; //Invoke the method here
//Method definition
function handleErrors(msg,url,lineno)
{
//Here we will get the error message along with page url with lineno so tracking the error will be easier
//Handle the error here
return true or false
}
2.Try and Catch block
try
{
//Run some code here
}
catch(err)
{
//Handle errors using error object
}
Tuesday, September 2, 2008
Creating a Secure PHP Login Script
This morning i was going through some article which tells about the methods that we can approach for secure login.You can check it in http://www.devshed.com/c/a/PHP/Creating-a-Secure-PHP-Login-Script/
Friday, August 29, 2008
Wednesday, August 27, 2008
How to use MySQL REPLACE function
update my_table SET `my_field` = replace(`my_field`, "old_text", "new_text")
Head over for more details to http://www.webmasterworld.com/forum10/8113.htm
Head over for more details to http://www.webmasterworld.com/forum10/8113.htm
Tuesday, August 19, 2008
Picking datatype for status field
Quite commonly in the applications you would need to use some kind of “status” field - status of order - “new”, “confirmed”, “in production”, “shipped” status of job, message etc. People use variety of ways to handle them often without giving enough thought to the choice which can cause problems later.For more details on this topic you find it on http://www.mysqlperformanceblog.com/2008/08/09/picking-datatype-for-status-feilds/
Wednesday, August 13, 2008
How to filter posted data easily in PHP?
Today i found one good article on how to filter the posted data in php.You can find the same in
http://roshanbh.com.np/2008/08/how-to-filter-posted-data-easily-in-php.html#more-217
http://roshanbh.com.np/2008/08/how-to-filter-posted-data-easily-in-php.html#more-217
Tuesday, August 12, 2008
ab - Apache HTTP server benchmarking tool
ab
is a tool for benchmarking your Apache Hypertext Transfer Protocol (HTTP) server. It is designed to give you an impression of how your current Apache installation performs. This especially shows you how many requests per second your Apache installation is capable of serving.You can find more details on how to use benchmark tool in below mentioned link.
Reference:
http://www.cyberciti.biz/tips/howto-performance-benchmarks-a-web-server.html
Friday, July 4, 2008
Riding carousels with jQuery
jCarousel is a jQuery plugin for controlling a list of items in horizontal or vertical order. The items, which can be static HTML content or loaded with (or without) AJAX, can be scrolled back and forth (with or without animation).
Reference:
http://sorgalla.com/jcarousel/
Reference:
http://sorgalla.com/jcarousel/
Thursday, July 3, 2008
Adobe(R) Acrobat(R) 9 Pro Extended
Check Out the New Adobe® Acrobat® 9 Pro Extended software.Now it includes Adobe Presenter, Adobe LiveCycle® Designer ES, and Adobe 3D Reviewer software.
You can embed Web Links, Video on Web Page, excel sheets, PowerPoint animation, transitions, & speaker notes within the PDF.
Refer the Link http://www.adobe.com/products/acrobatproextended/
You can embed Web Links, Video on Web Page, excel sheets, PowerPoint animation, transitions, & speaker notes within the PDF.
Refer the Link http://www.adobe.com/products
Wednesday, July 2, 2008
Few Helpful Jquery Links
http://www.malsup.com/jquery/form/#code-samples
http://marcgrabanski.com/article/list-of-useful-jquery-plugins
http://fancy.klade.lv/
http://visualjquery.com/1.1.2.html
http://www.sastgroup.com/jquery
http://jquery.com
http://www-128.ibm.com/developerworks/library/x-ajaxjquery.html
http://docs.jquery.com/Tutorials
http://marcgrabanski.com/article/list-of-useful-jquery-plugins
http://fancy.klade.lv/
http://visualjquery.com/1.1.2.html
http://www.sastgroup.com/jquery
http://jquery.com
http://www-128.ibm.com/developerworks/library/x-ajaxjquery.html
http://docs.jquery.com/Tutorials
Subscribe to:
Posts (Atom)