November 30, 2006
Going through the php document I came across magic constant __LINE__.
-What this contants does?
returns the current Line No. of the file.
-How we can use this constant in development?
I started using this function for most of the debugging purposes. I simply append it with my echo messages. So when I need to go to code, I can directly go the same line.
I more magical constant I used along with __LINE__ is __FILE__. __FILE__ gives the name of the current script file name.
These two functions reduced 20% of my debugging time.
November 28, 2006
I am working on the ColdfusionMX7 and Application.cfm is not working properly, I defined application variable and tried to output it on cfm page its giving me error
Element PAGENAME is undefined in APPLICATION.
My Application.cfm look like
<cfapplication name=”TestApp1″ clientManagement=”yes” sessionmanagement=”yes”>
Where as Application.cfc is working well, its look like
<cffunction name=”onapplicationStart” returntype=”boolean” output=”false”>
<cfset Application.pageName=”Application Inside page”>
What difference in between them? Any ideas
November 27, 2006
Its time for framework, something which offers ready code for most common things we do for every new project. There are numbers of php frameworks available online which allows rapid application development. Also most of the frameworks varies from their config style. Learning curve is again involved in learning these new framework. In many cases I found its quite difficult to customize the frameworks. Every framework has their own style of code which you might not be familiar with.
Then what to do, I thought how about writing my own framework. Some points which basic CRUD model should have are :
-Ready Classes structure
-Easy to understand by any other developer
-Should allow generation of Create, Read, Update and Delete in short CRUD
I have started thinking on the same line. I gone through old codes and started observing the common structure.
-in most of my projects I found all the classe has common structure
-common methods in each class eg. getByID, getAll, addUpdate
-inclusion of file is of same pattern
-most of the php code were common.
After identifying all these points, I started buidling my own framework. You believe me or not, my very basic framework was ready in just 2 hours.
I enjoyed building my own framework.
I will share my experience of building it next time.
November 24, 2006
In coldfusion I didnt find function to find values within array. Requirement was to look wheather specific value is present or not. Such function is present in PHP.
I look for various implmentation and I though structure could solve this issues. And magic logic works. Let me explain you what we did
-We received array, we converted it to the structure.
-Each value from the array is now treated as key in structure
-At the end we used structKeyExists function.
This way we achieved the functionality that we need.
November 24, 2006
While developing application, many times I found the need of redirecting your current page. Coldfusion has a nice cflocation tag which allow you load/redirect new page in the browser.
In between your script, when cflocation tag arrives, coldfusion simply stops the execution of the current page and opens a new page provided as url to cflocation tag.
November 24, 2006
-It basically identify if error is occured
-Based on that I pops up a div with Error message
-It dynamically finds the position of form element to Pop up the error message.
I am still working on it. While working on it I faced a problem with different browser mainly with IE and Mozilla.
I found some script on the net which finds the exact position based on the offsetParent property of any element.
I am trying to use functionality to provide the tooltip kinda of look and feel
I will explain the code, once I am done with the coding. I will upload it for review and later on publish it.
November 22, 2006
What is Ternary Operator ?
t’s a shortcut for an if-else statement, and is also known as a conditional operator. Its operate on the three input
Ternary operators save time and lines of code. Its more preferable when you are performing simple conditional operation.
In PHP it works as:
In coldfusion it works as:
There is not any direct implementation of operator, but coldfusion uses function IIf for the same purpose
Syntax : IIf(condition, string_expression1, string_expression2)
Without Ternary Operator
With Ternary Operator